1.<input @input=“onInput” :value=“phoneNum” type=“number” maxlength=“11”/>
3. method里面写
onInput(e){
this.phoneNum =e.detail.value
},
4.调用接口时候校验正则
if (!/^1[3456789]\d{9}$/.test(this.phoneNum)) {
uni.showToast({
title: '请输入正确的手机号',
icon: 'none'
});
return false;
}