el-input控制输入数字范围15到240

阅读 256

2022-02-15

 <el-input  style="width: 200px" placeholder="15到240的数字" type="number"
                                suffix-icon="el-icon-time" clearable v-model="time" οnkeyup="value=value.replace(/[^\d]/g,'')"  v-on:input="time=time>240?240:time"  v-on:blur="inputFunc()"></el-input>

inputFunc() {
      //监听 
      this.time = Number(this.time);
      if (this.time > 240) {
          this.time = 240;
      } else if (this.time < 15) {
          this.time = 15;
      }
  },

精彩评论(0)

0 0 举报