<input class="searchInput" :returnKeyType="'search'" @return="rSearch" v-model="goodsName" :placeholder="cateName" @blur="inputBlur" />如何禁止input输入空格
1 回答
萧十郎
TA贡献1815条经验 获得超13个赞
已解决,谢谢
<input @change="checkNo(goodsName)" class="searchInput" :returnKeyType="'search'" @return="rSearch" v-model="goodsName" :placeholder="cateName" @focus="getFocus" @blur="inputBlur" @input="getValue" /> // 搜索去空格 checkNo(e) { let reg = /^\S+$/; if (e) { if(new RegExp(reg).test(e) == false) { this.goodsName = this.goodsName.trim() } } }
添加回答
举报
0/150
提交
取消