|
|
@ -1,17 +1,19 @@
|
|
|
|
import variables from '@/assets/styles/element-variables.scss'
|
|
|
|
import variables from '@/assets/styles/element-variables.scss'
|
|
|
|
import defaultSettings from '@/settings'
|
|
|
|
import defaultSettings from '@/settings'
|
|
|
|
|
|
|
|
|
|
|
|
const { sideTheme, showSettings, topNav, tagsView, fixedHeader, sidebarLogo } = defaultSettings
|
|
|
|
const { sideTheme, showSettings, topNav, tagsView, fixedHeader, sidebarLogo, dynamicTitle } = defaultSettings
|
|
|
|
|
|
|
|
|
|
|
|
const storageSetting = JSON.parse(localStorage.getItem('layout-setting')) || ''
|
|
|
|
const storageSetting = JSON.parse(localStorage.getItem('layout-setting')) || ''
|
|
|
|
const state = {
|
|
|
|
const state = {
|
|
|
|
|
|
|
|
title: '',
|
|
|
|
theme: storageSetting.theme || variables.theme,
|
|
|
|
theme: storageSetting.theme || variables.theme,
|
|
|
|
sideTheme: storageSetting.sideTheme || sideTheme,
|
|
|
|
sideTheme: storageSetting.sideTheme || sideTheme,
|
|
|
|
showSettings: showSettings,
|
|
|
|
showSettings: showSettings,
|
|
|
|
topNav: storageSetting.topNav === undefined ? topNav : storageSetting.topNav,
|
|
|
|
topNav: storageSetting.topNav === undefined ? topNav : storageSetting.topNav,
|
|
|
|
tagsView: storageSetting.tagsView === undefined ? tagsView : storageSetting.tagsView,
|
|
|
|
tagsView: storageSetting.tagsView === undefined ? tagsView : storageSetting.tagsView,
|
|
|
|
fixedHeader: storageSetting.fixedHeader === undefined ? fixedHeader : storageSetting.fixedHeader,
|
|
|
|
fixedHeader: storageSetting.fixedHeader === undefined ? fixedHeader : storageSetting.fixedHeader,
|
|
|
|
sidebarLogo: storageSetting.sidebarLogo === undefined ? sidebarLogo : storageSetting.sidebarLogo
|
|
|
|
sidebarLogo: storageSetting.sidebarLogo === undefined ? sidebarLogo : storageSetting.sidebarLogo,
|
|
|
|
|
|
|
|
dynamicTitle: storageSetting.dynamicTitle === undefined ? dynamicTitle : storageSetting.dynamicTitle
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const mutations = {
|
|
|
|
const mutations = {
|
|
|
|
CHANGE_SETTING: (state, { key, value }) => {
|
|
|
|
CHANGE_SETTING: (state, { key, value }) => {
|
|
|
@ -22,8 +24,13 @@ const mutations = {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const actions = {
|
|
|
|
const actions = {
|
|
|
|
|
|
|
|
// 修改布局设置
|
|
|
|
changeSetting({ commit }, data) {
|
|
|
|
changeSetting({ commit }, data) {
|
|
|
|
commit('CHANGE_SETTING', data)
|
|
|
|
commit('CHANGE_SETTING', data)
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
// 设置网页标题
|
|
|
|
|
|
|
|
setTitle({ commit }, title) {
|
|
|
|
|
|
|
|
state.title = title
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|