input 输入框 只允许输入到小数点后两位

我就直接粘贴代码吧,亲自试过,有效

 <el-input placeholder="请输入"  @change="orderminchange"
 oninput="value=value.replace(/[^0-9.]/g,'')" v-model.trim="ordermin"
 controls-position="right" />
  orderminchange(e) {
      this.ordermin = e
      let News = this.split('.')
      if (News.length > 1) {
        if (News[1].length > 2) {
          this.ordermin = this.ordermin.substring(
            0,
            this.ordermin.indexOf('.') + 3
          )
        }
      }
    }, 
原文地址:https://www.cnblogs.com/lovebear123/p/14653305.html