input标签number类型禁用滚轮事件,隐藏上下箭头
-
隐藏上下箭头
<style> input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{ -webkit-appearance:textfield; } input[type="number"]{ -moz-appearance:textfield; } </style>
-
禁用滚轮事件
<template> <input type="number" onmousewheel="stopScrollFun" onDOMMouseScroll="stopScrollFun"/> </template> <script> function stopScrollFun(evt) { evt = evt || window.event; if(evt.preventDefault) { // Firefox evt.preventDefault(); evt.stopPropagation(); } else { // IE evt.cancelBubble=true; evt.returnValue = false; } return false; } </script>
-
vue中禁用滚轮事件
<input placeholder="请输入手机号码" type="number" @mousewheel.prevent />