修改bug

This commit is contained in:
zhouyanli
2026-08-04 11:56:12 +08:00
parent 5c8671a91e
commit 57756f016e
5 changed files with 45 additions and 20 deletions

View File

@@ -90,7 +90,7 @@
<scroll-view scroll-y class="form-box">
<view class="form-item">
<text class="label">住户名称</text>
<input class="input" v-model="form.name" placeholder="请输入真实姓名" placeholder-class="ph" maxlength="20"/>
<input class="input" v-model="form.name" @input="onNameInput" placeholder="请输入真实姓名" placeholder-class="ph" maxlength="20"/>
</view>
<view class="form-item">
@@ -117,7 +117,7 @@
<view class="form-item">
<text class="label">证件号码</text>
<input class="input" v-model="form.cardNo" placeholder="请输入证件号码" placeholder-class="ph" maxlength="18"/>
<input class="input" v-model="form.cardNo" @input="onCardNoInput" placeholder="请输入证件号码" placeholder-class="ph" maxlength="18"/>
</view>
<view class="form-item arrow-item" @click="openRelation">
@@ -507,6 +507,24 @@
}
// 住户名称输入过滤:只允许中文和字母
const onNameInput = (e) => {
const val = e.detail.value || ''
const filtered = val.replace(/[^一-龥a-zA-Z]/g, '')
if (filtered !== val) {
form.name = filtered
}
}
// 证件号码输入过滤:只允许字母和数字
const onCardNoInput = (e) => {
const val = e.detail.value || ''
const filtered = val.replace(/[^a-zA-Z0-9]/g, '')
if (filtered !== val) {
form.cardNo = filtered
}
}
const openCardType = () => {
showCardType.value = true
}