-
Notifications
You must be signed in to change notification settings - Fork 0
Development Skills & Tips
EricYang edited this page Jul 5, 2021
·
12 revisions
- 在代码里先console.log($this_variable);
- 在控制台找到打印出来的$this_variable,在它上面「点击右键」->「Store as global variable」;
- 在控制台会自动输出一个类似「temp1」的内容,然后在控制台输入「copy(temp1)」,然后新建一个文件「Control+C」即可把该对象复制出来。
- 该方法支持小程序开发者工具!
import JSEncrypt from 'jsencrypt';
// 公钥
const cloudPublicKey = `abcdefg`;
const encrypt = (value, publicKey = cloudPublicKey) => {
const jsEncrypt = new JSEncrypt({});
jsEncrypt.setPublicKey(publicKey);
return jsEncrypt.encrypt(value);
};
export default encrypt;
// 使用的时候
const enUsername = encrypt('username');- 使用husky,如下:
- package.json
{
"scripts":{
"prestart": "node config/fix-sls-offline.js",
"lint:eslint": "eslint --ignore-path .gitignore --ignore-pattern 'src/components/xxxx' --ignore-pattern src/assets/**/*.js",
"lint:license": "node ./config/license"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
"lint-staged": {
"*.{js,ts,tsx}": [ // 只对js,ts,tsx文件进行校验
"npm run lint:eslint",
"npm run lint:license"
]
}
}
2.