You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ts文件
import { JSEncrypt } from 'jsencrypt'
// 加密
export function encrypt(this: any, publicKey:string,txt:string) {
const encryptor = new JSEncrypt()
encryptor.setPublicKey(publicKey) // 设置公钥
return encryptor.encrypt(txt) // 对数据进行加密
}
报错信息为
index.js:575 Uncaught ReferenceError: window is not defined
at Object. (file:///Users/gaoxiaoyan/work/smartGpt/Insight-knowledge/client/node_modules/.pnpm/[email protected]/node_modules/jsencrypt/bin/jsencrypt.js:18:4)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at Module.require (node:internal/modules/cjs/loader:1143:19)
at require (node:internal/modules/cjs/helpers:110:18)
The text was updated successfully, but these errors were encountered:
ts文件
import { JSEncrypt } from 'jsencrypt'
// 加密
export function encrypt(this: any, publicKey:string,txt:string) {
const encryptor = new JSEncrypt()
encryptor.setPublicKey(publicKey) // 设置公钥
return encryptor.encrypt(txt) // 对数据进行加密
}
报错信息为
index.js:575 Uncaught ReferenceError: window is not defined
at Object. (file:///Users/gaoxiaoyan/work/smartGpt/Insight-knowledge/client/node_modules/.pnpm/[email protected]/node_modules/jsencrypt/bin/jsencrypt.js:18:4)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at Module.require (node:internal/modules/cjs/loader:1143:19)
at require (node:internal/modules/cjs/helpers:110:18)
The text was updated successfully, but these errors were encountered: