Ver código fonte

姓名限制

chenxiong 3 anos atrás
pai
commit
cf76359860
1 arquivos alterados com 13 adições e 1 exclusões
  1. 13 1
      pages2/wd/info.vue

+ 13 - 1
pages2/wd/info.vue

@@ -75,7 +75,7 @@
 	</u-modal>
 	<u-modal v-model="id_show" @confirm="confirmId" :show-cancel-button="true" title="修改关联信息">
 		<view class="slot-content">
-			<u-input v-model="realname" type="nickname" placeholder="请输入真实姓名" />
+			<u-input v-model="realname" @input="inputName(realname)" type="nickname" placeholder="请输入真实姓名" />
 			<u-input v-model="idCard" type="idcard" placeholder="请输入身份证" />
 		</view>
 	</u-modal>
@@ -172,6 +172,18 @@ export default {
 	onLoad(option) {
 	},
 	methods: {
+		inputName(value) {
+			if(value.trim()) {
+				var reg = /[^\u0391-\uFFE5A-Za-z]/g;
+				let newVal = value.trim().replace(reg,'')
+				
+				
+				
+				this.$nextTick(() => {
+					this.realname = newVal;
+				})
+			}
+		},
 		bindPickerChangeSex(e) {
 			let data = {sex:e.detail.value}
 			this.submitForm(data)