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
| import Vue from 'vue'
| import Vuex from 'vuex'
| Vue.use(Vuex)
| const store = new Vuex.Store({
| state: {
| hasLogin:false,
| userInfo:{},
| customerId:'', //商户ID
| lng:'', //商家的经纬度
| lat:'' ,//商家的经纬度
| openId:'', //微信ID
| },
| mutations: {
| login(state,res) {
| console.log(res,'res=====vuex')
| state.hasLogin = true
| state.userInfo = res
| state.customerId = res.id
| res.lng && (state.lng = res.lng)
| res.lat && (state.lat = res.lat)
| // res.lng ? state.lng = res.lng : state.lng = null
| // res.lat ? state.lat = res.lat : state.lat = null
| },
| setOpenId(state,openId) {
| state.openId = openId
| }
| },
| actions: {}
| })
| export default store
|
|