浩晨众云网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
利用vue.js 实现输入框输入值自动过滤特殊字符的功能?很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。
verifyInput(v){ let _this=this; let punctuation = /[`~!@#$%^&*_\-=<>?:"{}|.\/;'\\[\]·~!@#¥%……&——\-={}|《》?:“”【】、;‘'。、]/im; let arr=v.split('') let str='' arr.map(i=>{ if(!punctuation.test(i)){ str+=i } }) str=str.replace(/(/g,'(') str=str.replace(/)/g,')') str=str.replace(/,/g,',') this.$nextTick(j=>{ this.relatedWords=str }) },