add
yj
2024-12-05 b9900893177c78fc559223521fe839aa21000017
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import Vue from 'vue'
import Vuex from 'vuex'
 
Vue.use(Vuex)
 
const store = new Vuex.Store({
  state: {
    hasLogin: false,
    userInfo: {}
  },
  mutations: {
    login(state, provider) {
      state.hasLogin = true
      state.userInfo = provider
      uni.setStorageSync('userInfo', provider)
    },
    logout(state) {
      state.hasLogin = false
      state.userInfo = {}
      uni.removeStorageSync('userInfo')
    }
  },
  actions: {
 
  },
  getters: {
    getUserInfo(state) {
      return state.userInfo
    }
  }
})
 
export default store