mirror of
https://github.com/fantastic-admin/basic.git
synced 2026-10-07 09:43:17 +08:00
修复从移动端切换为pc端侧边栏可能强制被收起的bug
This commit is contained in:
+4
-7
@@ -16,13 +16,10 @@ export default {
|
||||
'$store.state.settings.mode': {
|
||||
handler() {
|
||||
if (this.$store.state.settings.mode == 'pc') {
|
||||
if (this.$store.state.settings.enableSidebarCollapse) {
|
||||
this.$store.commit('settings/updateThemeSetting', {
|
||||
'sidebarCollapse': false
|
||||
})
|
||||
}
|
||||
}
|
||||
if (this.$store.state.settings.mode == 'mobile') {
|
||||
this.$store.commit('settings/updateThemeSetting', {
|
||||
'sidebarCollapse': this.$store.state.settings.sidebarCollapseLastStatus
|
||||
})
|
||||
} else if (this.$store.state.settings.mode == 'mobile') {
|
||||
this.$store.commit('settings/updateThemeSetting', {
|
||||
'sidebarCollapse': true
|
||||
})
|
||||
|
||||
@@ -5,6 +5,8 @@ import setting from '@/setting'
|
||||
|
||||
const state = {
|
||||
...setting,
|
||||
// 侧边栏是否收起(用于记录 pc 模式下最后的状态)
|
||||
sidebarCollapseLastStatus: setting.sidebarCollapse,
|
||||
// 显示模式,支持:mobile、pc
|
||||
mode: 'pc',
|
||||
// 页面标题
|
||||
@@ -31,6 +33,9 @@ const mutations = {
|
||||
// 切换侧边栏导航展开/收起
|
||||
toggleSidebarCollapse(state) {
|
||||
state.sidebarCollapse = !state.sidebarCollapse
|
||||
if (state.mode == 'pc') {
|
||||
state.sidebarCollapseLastStatus = !state.sidebarCollapseLastStatus
|
||||
}
|
||||
},
|
||||
// 更新主题配置
|
||||
updateThemeSetting(state, data) {
|
||||
|
||||
Reference in New Issue
Block a user