js中对一些特殊字符进行转义
addEscape(value) {
let arr = ['(', '[', '{', '/', '^', '$', '¦', '}', ']', ')', '?', '*', '+', '.', "'", '"']
for (let i = 0; i < arr.length; i++) {
if (value) {
if (value.indexOf(arr[i]) > -1) {
const reg = (str) => str.replace(/[\[\]\/\{\}\(\)\*\'\"\¦\+\?\.\\\^\$\|]/g, "\\$&")
value = reg(value)
}
}
}
return value;
},