tips:解决了e.target中输入中文 会把拼音也输入的情况
1 html
<FormItem label="角色名称" prop="roleName">
<Input v-model="formInfoData.roleName" placeholder="请输入角色名称" maxlength="20" @on-keyup="btKeyUp('roleName')" @on-keydown="btKeyDown('roleName')"/>
</FormItem>
2 vue
//只能输入汉字英文数字
btKeyDown(name) {
this.formInfoData[name] = this.formInfoData[name].replace(/[^\a-\z\A-\Z0-9\u4E00-\u9FA5]\_/g,"");
},
//控制不能输入特殊字符
btKeyUp(name) {
this.formInfoData[name]= this.formInfoData[name].replace(/[`~!@#$%^&*()\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/g,"");
},