vue input 只允许输入整数、整数和小数(保留小数点后两位)
生活随笔
收集整理的這篇文章主要介紹了
vue input 只允许输入整数、整数和小数(保留小数点后两位)
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
###?input只允許輸入整數(shù)和小數(shù)(小數(shù)只保留小數(shù)點(diǎn)后兩位)
<el-input?size="small"?onkeyup="this.value=this.value.match(/\d+\.?\d{0,2}/)"onafterpaste="this.value=this.value.match(/\d+\.?\d{0,2}/)"v-model="scope.row.agentPrice"maxlength="9"></el-input>?
###?input只允許輸入整數(shù)
<el-input?size="small"?onkeyup="this.value=this.value.replace(/\D/g,'')"onafterpaste="this.value=this.value.replace(/\D/g,'')"v-model.number="scope.row.quantityNum"?maxlength="9"></el-input>?
總結(jié)
以上是生活随笔為你收集整理的vue input 只允许输入整数、整数和小数(保留小数点后两位)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: java资源池的实现
- 下一篇: 基于词典的细粒度情感分析