el-input 常用技巧(持续更新)

201 阅读1分钟

1.不可以输入负数:min="0" 但是可以输入保留2位小数

                       <el-input
                      :disabled="goodManageForm.freightType !== 0"
                      :min="0"
                      placeholder="请输入"
                      type="number"
                      oninput=" value=value.indexOf('.') > -1?value.slice(0, value.indexOf('.')                       + 3):value"
                      v-model="goodManageForm.freightFee"
                      style="width:30%"
                      class="price-desc"
                      clearable
                    >

2.去掉:上下箭头

参考: blog.csdn.net/louting249/…


//全局去除input的type为number时的上下箭头
::v-deep input::-webkit-outer-spin-button,
::v-deep input::-webkit-inner-spin-button { -webkit-appearance: none; }
::v-deep input[type="number"]{ -moz-appearance: textfield; }