头闻号

常州聚宝化工有限公司

化工原料代理加盟|增塑剂|热稳定剂|羧酸|钛白粉|色母料

首页 > 新闻中心 > 科技常识:去掉input标签中type=number时的小箭头
科技常识:去掉input标签中type=number时的小箭头
发布时间:2023-02-01 10:53:55        浏览次数:4        返回列表

今天小编跟大家讲解下有关去掉input标签中type=number时的小箭头 ,相信小伙伴们对这个话题应该有所关注吧,小编也收集到了有关去掉input标签中type=number时的小箭头 的相关资料,希望小伙伴们看了有所帮助。

css部分如下:

<style> input::-webkit-outer-spin-button, input::-webkit-inner-spin-button{ -webkit-appearance: none !important; margin: 0; } input[type="number"]{-moz-appearance:textfield;}</style>

js部分如下,框架使用:elementui+vue

getPersonnelConditionNum(e){ // console.log(typeof(this.ruleForm.personnelConditionNum)); //判断输入的值的类型 if(typeof(this.ruleForm.personnelConditionNum)=="string"){ this.ruleForm.personnelConditionNum ="";return; } if(this.ruleForm.personnelConditionNum > 2147483647){ this.ruleForm.personnelConditionNum = 2147483647;return; }},

html部分如下:

<el-input @mousewheel.native.prevent maxlength="10"@input="getPersonnelConditionNum"v-model.number="ruleForm.personnelConditionNum"placeholder="最大值不能超过2147483647"></el-input>

@mousewheel.native.prevent禁止type=number类型的input框滚动赋值,maxlength="10"最大长度。

v-model.number限制输入的类型为number类型

来源:爱蒂网