2020
10-09
10-09
vue 限制input只能输入正数的操作
在某些项目中input框只能输入数字,可以用以下办法:先在标签上绑定上@input事件来监听标签的值变化,通过正则来改变输入的值。<inputclass="keep_input"v-number-onlystyle="width:35px"v-model="scope.row.fileOrder"@input="scope.row.fileOrder=Number($event.target.value.replace(/\D+/,''))"/>第二部封装个自定义指令放在标签上!directives:{numberOnly:{bind:function(el){el.handler=...
继续阅读 >