import CryptoJS from 'crypto-js' const SECRET_KEY = 'your-secret-key' // 设置加密密钥 export default { set(key, value) { const encrypted = CryptoJS.AES.encrypt(value, SECRET_KEY).toString() localStorage.setItem(key, encrypted) }, get(key) { const encrypted = localStorage.getItem(key) if (!encrypted) return null try { return CryptoJS.AES.decrypt(encrypted, SECRET_KEY).toString(CryptoJS.enc.Utf8) } catch { return null } }, remove(key) { localStorage.removeItem(key) } }