<el-form-item label="端口:" class="form-item" prop="port">
<el-input v-model.number="formData.port" type="number" placeholder="请 输入" style="width: 100%;" @mousewheel.native.prevent></el-input>
</el-form-item>
/deep/ input::-webkit-outer-spin-button,
/deep/ input::-webkit-inner-spin-button {
-webkit-appearance: none !important;
}
/deep/ input[type='number'] {
-moz-appearance: textfield !important;
}
@mousewheel.native.prevent 阻止滚轮事件,在谷歌有效果,火狐没反应
<el-form-item label="运行端口:" class="form-item" prop="port">
<el-input v-model.number="formData.port" type="number" placeholder="请输入" style="width: 100%;" @wheel.native.prevent="stopScrollFun($event)"></el-input>
</el-form-item>
stopScrollFun(evt) {
evt = evt || window.event;
if(evt.preventDefault) {
// Firefox
evt.preventDefault();
evt.stopPropagation();
} else {
// IE
evt.cancelBubble=true;
evt.returnValue = false;
}
return false;
},
端口规则:整型 0-65535
port: [{required: true,message: "请填写",trigger: "blur"},{type:'integer',min:0,max:65535,message:'请输入0-65535的整数'}],
参考:https://blog.csdn.net/yangdl6/article/details/108662028
https://blog.csdn.net/qq_40190624/article/details/104994782
联系客服