const chinese = /[^u4E00-u9FA5]/g const number = /[^d]/g; const englishAndNum =/[W]/g if ((chinese.test(this.data.username))) { wx.showToast({ title: "只允许输入中文", icon: "none" }); return false; } if ((number.test(this.data.username))) { wx.showToast({ title: "只允许输入数字", icon: "none" }); return false; } if ((englishAndNum.test(this.data.username))) { wx.showToast({ title: "只允许输入英文加数字", icon: "none" }); return false; }