vue组件引入
import { JSEncrypt } from 'jsencrypt'
方法内使用
let publicKey = asdfsafdadfafasjdhfasfd // 从后台获取公钥,这里省略,直接赋值 let encryptor = new JSEncrypt() // 新建JSEncrypt对象 encryptor.setPublicKey(publicKey) // 设置公钥 let rsaPassWord = encryptor.encrypt(password) // 对密码进行加密
参考: https://blog.csdn.net/u013344993/article/details/79984968