perf: layout

This commit is contained in:
xiaoxian521
2021-10-11 15:14:00 +08:00
parent c49fbde0b5
commit 11178d8fd5
5 changed files with 108 additions and 28 deletions

View File

@@ -8,6 +8,7 @@ interface AppState {
opened: boolean;
withoutAnimation: boolean;
};
layout: string;
device: string;
}
@@ -20,6 +21,9 @@ export const useAppStore = defineStore({
: true,
withoutAnimation: false
},
layout:
storageLocal.getItem("responsive-layout")?.layout.match(/(.*)-/)[1] ??
"vertical",
device: deviceDetection() ? "mobile" : "desktop"
}),
getters: {
@@ -56,6 +60,9 @@ export const useAppStore = defineStore({
},
toggleDevice(device) {
this.TOGGLE_DEVICE(device);
},
setLayout(layout) {
this.layout = layout;
}
}
});