element-ui问题

28 阅读1分钟
  • elementui input=number处理样式
//input标签中加入
@keydown.native="
                e =>
                  (e.returnValue = ['e', 'E', '-', '+'].includes(e.key)
                    ? false
                    : e.returnValue)
              "
              oninput="if(value>=10**3){value=value.slice(0,3)};if(value.indexOf('.')>0){value=value.slice(0,value.indexOf('.')+3)}"
              
 //样式添加
 .inputScore-container {
  /deep/ input::-webkit-outer-spin-button,
  /deep/ input::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
  }
  /deep/ input[type='number'] {
    -moz-appearance: textfield !important;
  }
  /deep/.el-input__inner {
    line-height: 1px !important;
  }
}

外层可包裹class=inputScore-container,防止影响其他input
              
  • 在手机模式下部分组件点击会出现一瞬间的背景颜色 在组件的根样式添加代码
-webkit-tap-highlight-color: transparent !important;