JS 转义input输入的特殊字符
JS 转义input输入的特殊字符 将包含所有特殊字符的列表:[ ] { } ( ) \ ^ $ . | ? * + 等特殊符号, 增加反斜杠转义。 export const escapeRegExp = (text: string) => { return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");};
继续阅读
某二维码追溯系统
macOS 使用 shadowsocks 为 Github(Gitlab) 设置代理(HTTP/SSH)
macOS 使用 shadowsocks 为 Github(Gitlab) 设置代理(HTTP/SSH) brew install socat Host github.com User root IdentityFile ~/.ssh/id_rsa_gitlab ProxyCommand socat - PROXY:127.0.0.1:%h:%p,proxyport=1087对于Windows用户,要使用socks5代理却没有 nc 的,可以将ProxyCommand nc -v
继续阅读
JavaScript 数组中Map和ForEach的区别
1. forEach 是一个普通迭代函数执行里面的逻辑2. map会迭代完成后 根据迭代内容的返回值 生成新的数组对象let arr = [1, 2, 3, 4, 5];let doubled1 = [];arr.forEach(num => { doubled1.push(num * 2);});let doubled2 = arr.map(num => { return num * 2;});
继续阅读
umijs 提示: eslint assignment to property of function parameter 'state'. (no-param-reassign)
eslint assignment to property of function parameter 'state'. (no-param-reassign) 使用umijs 创建项目 yarn create @umijs/umi-app更新 state 时提示eslintjjijiajianjian c监测报错 eslint assignment to property of function parameter 'state'. (no-param-reassign)addUser(state: any, action: any) { sta
继续阅读
javascript声明函数的三种方式
js函数声明方式的三种方式/** * 1:直接声明方式 */function function1(a, b, c) { console.log(a + b + c);}function1(1, 2, 3); //6/** * 2:函数表达式 */var function2 = function (a, b, c) { console.log(a + b + c);};function2(1, 2, 3); //6/** * 3:通过构造函数方式 * 支持创建动态函数,动态
继续阅读