Blame view

src/store/modules/app.js 704 Bytes
赵千 committed
1 2 3
import Cookies from 'js-cookie'

const state = {
任超 committed
4
    size: 'small',
任超 committed
5
    theme: '#409EFF',
任超 committed
6
    splitScreen: false,
赵千 committed
7 8 9 10 11 12
}

const mutations = {
    SET_SIZE: (state, size) => {
        state.size = size
        Cookies.set('size', size)
任超 committed
13 14 15 16
    },
    UPDATE_THEME (state, val) {
        state.theme = val;
    },
任超 committed
17 18
    SET_SCREEN (state, val) {
        state.splitScreen = val;
任超 committed
19
    },
赵千 committed
20 21 22 23 24
}

const actions = {
    setSize ({ commit }, size) {
        commit('SET_SIZE', size)
任超 committed
25 26 27
    },
    updateTheme ({ commit }, val) {
        commit('UPDATE_THEME', val)
任超 committed
28 29 30
    },
    settScreen ({ commit }, val) {
        commit('SET_SCREEN', val)
任超 committed
31
    },
赵千 committed
32 33 34 35 36 37 38 39
}

export default {
    namespaced: true,
    state,
    mutations,
    actions
}