Blame view

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

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

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

const actions = {
    setSize ({ commit }, size) {
        commit('SET_SIZE', size)
任超 committed
21 22 23
    },
    updateTheme ({ commit }, val) {
        commit('UPDATE_THEME', val)
赵千 committed
24 25 26 27 28 29 30 31 32
    }
}

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