Vue+ElementUI,input控件清空数据恢复问题

在Vue+ElementUI 中做数据校验。当用户输入错误时清空input控件在特定情况下会出现原有清空数据会恢复。这是因为在Vue中数据是双向绑定的,只清空控件文字但form表单中还有数据。

======  此问题暂无解决方案  =====

附问题代码:

1 <el-form-item label="编号" prop="asgnum" >
2     <el-input v-model="form.asgnum" auto-complete="off" placeholder="请输入编号" maxLength="50"
3               onblur ="if(this.value.replace(/[\u4E00-\u9FA5]/g,'aa').length > this.maxLength){//超过就提示
4                         alert('不得超过' + this.maxLength + '个字符(中文占2个字符)');this.value='';}">
5     </el-input>
6 </el-form-item>

猜你喜欢

转载自www.cnblogs.com/ic710/p/10942104.html