1.下载组件
npm install --save jsencrypt
2.在main中引入
import Vuetify from 'vuetify'; import 'vuetify/dist/vuetify.min.css'; Vue.use(Vuetify)
3、页面中如何使用
let publicKey = '1341343141234' // 从后台获取的公钥或是直接拿取的公钥,这里省略,直接赋值let params = jse.encrypt((JSON.stringify({'id':id})));
let encryptor = new JSEncrypt() // 新建JSEncrypt对象
encryptor.setPublicKey(publicKey) // 设置公钥
let rsaAccount= encryptor.encrypt(account) // 对帐号进行加密
//如果对整个对象加密,记得用JSON.stringify转化一次成字符再加密,否则解密不出来;
标签:公钥,加密,encryptor,rsa,vue,let,vuetify,JSEncrypt From: https://www.cnblogs.com/tanweiwei/p/16870734.html