-
Notifications
You must be signed in to change notification settings - Fork 0
Development Skills & Tips
EricYang edited this page Jun 30, 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');