- 引用element中的input type=number组件
<el-input type="number" v-model.number="numberData"></el-input>
- 去掉input type=number尾部上下小箭头采用CSS样式重置的方式
/* element样式重置 start */
/* 去掉input尾部上下小箭头 start */
input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{
-webkit-appearance: none !important;
-moz-appearance: none !important;
-o-appearance: none !important;
-ms-appearance: none !important;
appearance: none !important;
margin: 0;
}
input[type="number"]{
-webkit-appearance:textfield;
-moz-appearance:textfield;
-o-appearance:textfield;
-ms-appearance:textfield;
appearance:textfield;
}
/* 去掉input尾部上下小箭头 end */
- 去掉上下滚动鼠标,input type=number框里值变动的效果
在el-input加上@mousewheel.native.prevent来阻止鼠标滚动
<el-input type="number" v-model.number="numberData" @mousewheel.native.prevent></el-input>
网友评论