rt-sim-training-client/src/store/modules/settings.js

32 lines
512 B
JavaScript
Raw Normal View History

2019-07-25 10:30:30 +08:00
import defaultSettings from '@/settings';
2019-07-02 16:29:52 +08:00
2019-07-25 10:30:30 +08:00
const { showSettings, fixedHeader, sidebarLogo } = defaultSettings;
2019-07-02 16:29:52 +08:00
const state = {
showSettings: showSettings,
fixedHeader: fixedHeader,
sidebarLogo: sidebarLogo
2019-07-25 10:30:30 +08:00
};
2019-07-02 16:29:52 +08:00
const mutations = {
CHANGE_SETTING: (state, { key, value }) => {
if (state.hasOwnProperty(key)) {
2019-07-25 10:30:30 +08:00
state[key] = value;
2019-07-02 16:29:52 +08:00
}
}
2019-07-25 10:30:30 +08:00
};
2019-07-02 16:29:52 +08:00
const actions = {
changeSetting({ commit }, data) {
2019-07-25 10:30:30 +08:00
commit('CHANGE_SETTING', data);
2019-07-02 16:29:52 +08:00
}
2019-07-25 10:30:30 +08:00
};
2019-07-02 16:29:52 +08:00
export default {
namespaced: true,
state,
mutations,
actions
2019-07-25 10:30:30 +08:00
};
2019-07-02 16:29:52 +08:00