代码优化

This commit is contained in:
kron
2025-06-02 14:42:07 +08:00
parent 43889669d7
commit 1eab5a151e
6 changed files with 118 additions and 119 deletions

View File

@@ -14,6 +14,7 @@ export default defineStore("store", {
id: "",
deviceName: "",
},
config: {},
}),
// 计算属性
@@ -32,6 +33,9 @@ export default defineStore("store", {
this.device.id = deviceId;
this.device.deviceName = deviceName;
},
updateConfig(config) {
this.config = config;
},
},
// 开启数据持久化
@@ -40,7 +44,7 @@ export default defineStore("store", {
strategies: [
{
storage: uni.getStorageSync,
paths: ["user", "device"], // 只持久化用户信息
paths: ["user", "device", "config"], // 只持久化用户信息
},
],
},