vue实现输入框为正整数elementUI input

vue实现输入框为正整数elementUI input,第1张


<el-input v-model.trim="adminInfo.hrFloor"  @keyup.native="keyup('hrFloor')" @afterpaste="afterpaste('hrFloor')" placeholder="请填写层高"></el-input>

	keyup(data) {
				if (this.adminInfo[data].length == 1) {
					this.adminInfo[data] = this.adminInfo[data].replace(/[^1-9]/g, "");
				} else {
					this.adminInfo[data] = this.adminInfo[data].replace(/\D/g, "");
				}
			},
			afterpaste(data) {
				if (this.adminInfo[data].length == 1) {
					this.adminInfo[data] = this.adminInfo[data].replace(/[^1-9]/g, "");
				} else {
					this.adminInfo[data] = this.adminInfo[data].replace(/\D/g, "");
			 }
			},
 `

欢迎分享,转载请注明来源:内存溢出

原文地址: https://www.outofmemory.cn/web/945333.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-18
下一篇 2022-05-18

发表评论

登录后才能评论

评论列表(0条)

保存