0
点赞
收藏
分享

微信扫一扫

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

十里一走马 2022-02-15 阅读 256
经验分享

 <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 条评论