解決方案: 綁定oninput事件,返回對應的value就行。注意:此方法在element2.4.11(目前最新版本)上可行,2.4.11版本this指向input元素,在2.3.9版本上不可行,由於2.3.9版本上this指向的是div元素,沒有value這個屬性。bash
<el-autocomplete oninput="this.value=this.value.replace(/[\u4e00-\u9fa5\d]/g,'');"></el-autocomplete>
複製代碼
<el-autocomplete ref="auto" v-model="input"></el-autocomplete>
this.$refs.auto.close();
this.$refs.auto.$children[0].blur();
複製代碼