当前位置: 代码迷 >> 综合 >> vue input 只允许输入整数、整数和小数(保留小数点后两位)
  详细解决方案

vue input 只允许输入整数、整数和小数(保留小数点后两位)

热度:84   发布时间:2024-02-07 10:40:55.0

### input只允许输入整数和小数(小数只保留小数点后两位)

<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只允许输入整数

<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>

 

  相关解决方案