Save the status of menu bar(collapse/expand) in browser memory

This commit is contained in:
Karlis Cudars 2021-10-31 00:16:39 +03:00
parent 540906b9e3
commit 28bc283f29

View file

@ -118,12 +118,24 @@ export default {
hideText: this.collapsed, hideText: this.collapsed,
}; };
}, },
mounted() {
if (this.getPreferenceBoolean("menuCollapse", false)) {
this.collapsed = true;
this.hideText = true;
this.collapseText = true;
} else {
this.collapsed = false;
this.hideText = false;
this.collapseText = false;
}
},
setup() { setup() {
const { menuCollapsed, toggleCollapsed } = useMenuCollapsed(); const { menuCollapsed, toggleCollapsed } = useMenuCollapsed();
return { collapsed: menuCollapsed, toggleCollapsed }; return { collapsed: menuCollapsed, toggleCollapsed };
}, },
watch: { watch: {
collapsed(_collapsed) { collapsed(_collapsed) {
this.setPreference("menuCollapse", _collapsed);
if (this.enableAnimations) { if (this.enableAnimations) {
if (_collapsed) { if (_collapsed) {
this.collapseText = true; this.collapseText = true;