vue input输入框限制只能输入正整数
<template> <label>年龄:</label> <input type="number" v-model="value" placeholder="请输入" @keydown="positiveInt($event)"> </template>
positiveInt(e) { let prohibitInput = ["-", "e", "+", "E", "."]; if (prohibitInput.includes(e.key)) { e.preventDefault() } }