npm加載jsencrypt ,你也可以下載js文件在index引用或者直接引用線上的,不在敘述
npm i jsencrypt -S
min.js寫入
import JSEncrypt from 'jsencrypt';//引用模塊
Vue.prototype.$jsEncrypt = JSEncrypt;//全局
在你的上傳方法里面寫入,一般在獲取后端回調的公鑰里面寫入
const jse = new this.$jsEncrypt()//創建
jse.setPublicKey("")//配置公鑰,一般都為后端傳輸過來的
this.name = jse.encrypt("你的賬戶或者密碼")