1、应用系统字符(%¥……&,防SQL注入)输入框的特殊字符过滤:
在main.js 引入以下代码,即可全局使用。
Vue.prototype.validSe = function(value) { value = value.replace(/[`~*~!@#$%^&*()_\-+=<>?:"{}|,./;‘\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/g, ‘‘).replace( /\s/g, ""); return value; };
在需要用到的地方:
<el-input :value="searchVal.Title" @input="e => (searchVal.Title = validSe(e))" placeholder="请输入标题">
</el-input>
原文:https://www.cnblogs.com/XiaoYEBLog/p/13936561.html