代码优化
This commit is contained in:
@@ -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"], // 只持久化用户信息
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user