import Vue from 'vue'
// 阻止type="number"鼠标滚动改变数值
Vue.directive( 'stopNumberMousewheel', {
inserted: function ( el ) {
const ele = el.tagName === 'INPUT' ? el : el.querySelector( 'input' )
ele.addEventListener( "mousewheel", () => {
ele.blur();
} )
}
} )
// 阻止数字输入鼠标滚轮改变数值
import "@/directive/stopNumberMousewheel";
<el-input v-model="test" v-stopNumberMousewheel type="number"></el-input>