You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.1 KiB
47 lines
1.1 KiB
import defaultSettings from '@/settings'
|
|
|
|
const { sideTheme, showSettings, topNav, tagsView, fixedHeader, sidebarLogo, uniqueOpened, showFooter, footerTxt, caseNumber } = defaultSettings
|
|
|
|
// const storageSetting = JSON.parse(localStorage.getItem('layout-setting')) || ''
|
|
const storageSetting = JSON.stringify(localStorage.getItem('layout-setting')) || ''
|
|
const state = {
|
|
title: '',
|
|
theme: storageSetting.theme || '#409EFF',
|
|
sideTheme: storageSetting.sideTheme || sideTheme,
|
|
showSettings: showSettings,
|
|
topNav: storageSetting.topNav === undefined ? topNav : storageSetting.topNav,
|
|
tagsView: tagsView,
|
|
fixedHeader: fixedHeader,
|
|
sidebarLogo: sidebarLogo,
|
|
uniqueOpened: uniqueOpened,
|
|
showFooter: showFooter,
|
|
footerTxt: footerTxt,
|
|
caseNumber: caseNumber
|
|
|
|
}
|
|
|
|
const mutations = {
|
|
CHANGE_SETTING: (state, { key, value }) => {
|
|
if (state.hasOwnProperty(key)) {
|
|
state[key] = value
|
|
}
|
|
}
|
|
}
|
|
|
|
const actions = {
|
|
changeSetting({ commit }, data) {
|
|
commit('CHANGE_SETTING', data)
|
|
},
|
|
// 设置网页标题
|
|
setTitle({ commit }, title) {
|
|
state.title = title
|
|
}
|
|
}
|
|
|
|
export default {
|
|
namespaced: true,
|
|
state,
|
|
mutations,
|
|
actions
|
|
}
|
|
|
|
|