12345678910111213141516171819202122232425262728 |
- const state = () => ({
- userInfo: {},
- })
- const mutations = {
- // 设置用户信息
- SET_USER_INFO(state, data) {
- state.userInfo = data
- },
- }
- const actions = {
- // 退出登录
- logout({ commit }) {
- commit('SET_USER_INFO', {})
- },
- // 用户登录
- login({ commit }, data) {
- commit('SET_USER_INFO', data)
- },
- }
- export default {
- namespaced: true,
- state,
- mutations,
- actions,
- }
|