Vue Element项目中,如何实现过滤输入框中的特殊字符功能?
- 内容介绍
- 文章标签
- 相关推荐
本文共计615个文字,预计阅读时间需要3分钟。
在main.js中添加方法:
javascriptVue.prototype.validSe=function(value, number=255) { value=value.replace(/[`~!@#$%^&*()_+{}|:?]/g, ''); return value.length <=number;};

可以在main.js中写入方法
Vue.prototype.validSe = function (value, number = 255) { value = value.replace(/[`~*~!@#$%^&*()_\-+=<>?:"{}|,./;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”、;‘',。
本文共计615个文字,预计阅读时间需要3分钟。
在main.js中添加方法:
javascriptVue.prototype.validSe=function(value, number=255) { value=value.replace(/[`~!@#$%^&*()_+{}|:?]/g, ''); return value.length <=number;};

可以在main.js中写入方法
Vue.prototype.validSe = function (value, number = 255) { value = value.replace(/[`~*~!@#$%^&*()_\-+=<>?:"{}|,./;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”、;‘',。

