如下所示:
1、
<input placeholder="請輸入條形碼" class="disPriceStyle" v-model = 'searcBarCode'></input>、 (只能輸入數字,英文)<input placeholder="請輸入商品條形碼" class="disPriceStyle" maxlength="20" v-model = 'searchGoodsName'></input> (只能輸入數字,英文及中文)<input placeholder="請輸入活動名稱" class="disPriceStyle" maxlength="20" v-model="searchProName"></input> (只能輸入數字,英文及中文)
2、
watch:{   searcBarCode:function(){    this.searcBarCode=this.searcBarCode.replace(/[/W]/g,'');   },   searchGoodsName:function(){    this.searchGoodsName = this.searchGoodsName.replace(/[^A-Za-z0-9/u4e00-/u9fa5]/g,'');   },   searchProName:function(){    this.searchProName = this.searchProName.replace(/[^A-Za-z0-9/u4e00-/u9fa5]/g,'');   }  },以上這篇解決vue中監聽input只能輸入數字及英文或者其他情況的問題就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持錯新站長站。
新聞熱點
疑難解答
圖片精選