long
2021-08-18 08bd89345399c05df87ad065918494837b9d57bb
提交 | 用户 | age
2a61f6 1 import variables from '@/styles/element-variables.scss'
L 2 import defaultSettings from '@/settings'
3
4 const { showSettings, tagsView, fixedHeader, sidebarLogo } = defaultSettings
5
6 const state = {
7   theme: variables.theme,
8   showSettings: showSettings,
9   tagsView: tagsView,
10   fixedHeader: fixedHeader,
11   sidebarLogo: sidebarLogo
12 }
13
14 const mutations = {
15   CHANGE_SETTING: (state, { key, value }) => {
16     // eslint-disable-next-line no-prototype-builtins
17     if (state.hasOwnProperty(key)) {
18       state[key] = value
19     }
20   }
21 }
22
23 const actions = {
24   changeSetting({ commit }, data) {
25     commit('CHANGE_SETTING', data)
26   }
27 }
28
29 export default {
30   namespaced: true,
31   state,
32   mutations,
33   actions
34 }
35