input只能输入数字

<input
v-if="showSureBtn"
class="rt"
placeholder="必填"
oninput="value=value.replace(/[^d]/g,'')"
maxlength="12"
v-model="taxpayersPhone"
@focus="clearPhone=true"
@blur="clearPhone=false"
>
 
oninput="value=value.replace(!/^(([1-9]{1}d*)|([0]{1}))(.(d){0,2})?$/,'')"   //只能输入数字跟小数点.  
 
注意“maxlength 在type为number的时候不生效
原文地址:https://www.cnblogs.com/leeder/p/11419519.html