vue input限制只能输入数字
<input class="wd50" @keydown="handleInput" />
handleInput(e) {
let a = e.key.replace(/[^\d]/g, "");
if (!a && e.keyCode !== 8) {
e.preventDefault();
}
}
<input class="ibk balanceInput" type="text" v-model="rechargeVal.balanceInput" :onkeyup="rechargeVal.balanceInput=rechargeVal.balanceInput.replace(/\D|\b(0+)/g,'')" :onafterpaste="rechargeVal.balanceInput=rechargeVal.balanceInput.replace(/\D/g,'')" />
只能输入数字及一个小数点
:onkeyup="cashVal=cashVal.replace(/[^\d.]/g,'')"
限制输入英文和数字
<input type="text" onkeyup="value=value.replace(/[\u4e00-\u9fa5]/ig,'')" />