input增加参数

@keyup.native="inputChange($event)" @keydown.native="inputChange($event)"

增加方法

inputChange(event) {
  const val = event.target;
  val.value = val.value.replace(/[^\u4E00-\u9FA5]/g, '');
  this.name = val.value;
},

源代码:

<el-input v-model="formValue.supplier.name" 
		@keyup.native="inputChange($event)" 
		@keydown.native="inputChange($event)">
</el-input>
inputChange(event) {
  const val = event.target;
  val.value = val.value.replace(/[^\u4E00-\u9FA5]/g, '');
  this.formValue.supplier.name = val.value;
},
Logo

前往低代码交流专区

更多推荐