ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
## 设置存储 SetStorage、SetStorageSync(同步) ### 平台 - 全平台 ### 参数 名称 | 类型 | 是否必填|说明 :-----------: | :-----------: | :-----------: | ----------- key | String | 是 | 字段key value | Any | 是 | 存储值 expire | Int | 否 | 过期时长,单位:秒,不填写默认是config配置 ### 示例 ``` this.$SetStorage("user",{user_id:1,name:"张三"},3600) ``` ## 获取存储 GetStorage、GetStorageSync(同步) ### 平台 - 全平台 ### 参数 名称 | 类型 | 是否必填|说明 :-----------: | :-----------: | :-----------: | ----------- key | String | 是 | 字段key ### 示例 ``` this.$GetStorage("user").then(res=>{ console.log(res.data) }) let user = this.$GetStorageSync("user") console.log(user) ``` ## 删除存储 RemoveStorage、RemoveStorageSync(同步) ### 平台 - 全平台 ### 参数 名称 | 类型 | 是否必填|说明 :-----------: | :-----------: | :-----------: | ----------- key | String | 是 | 字段key ### 示例 ``` this.$RemoveStorage("user") this.$RemoveStorageSync("user") ``` ## 清空存储 ClearStorage、ClearStorageSync(同步) ### 平台 - 全平台 ### 参数 无 ### 示例 ``` this.$ClearStorage() this.$ClearStorageSync() ```