搭建项目
This commit is contained in:
40
vuex/modules/data.js
Normal file
40
vuex/modules/data.js
Normal file
@@ -0,0 +1,40 @@
|
||||
import * as types from '../types'
|
||||
const state = {
|
||||
publicObj: '',
|
||||
publicArr: '',
|
||||
navTab: uni.getStorageSync('navTab') || 1,
|
||||
}
|
||||
const getters = {
|
||||
publicObj: state => state.publicObj,
|
||||
publicArr: state => state.publicArr,
|
||||
navTab: state => state.navTab
|
||||
}
|
||||
const actions = {
|
||||
setPublicObj ({commit}, res) {
|
||||
commit(types.PUBLIC_OBJ, res)
|
||||
},
|
||||
setPublicArr ({commit}, res) {
|
||||
commit(types.PUBLIC_ARR, res)
|
||||
},
|
||||
setNavTab ({commit}, res) {
|
||||
uni.setStorageSync('navTab', res)
|
||||
commit(types.SET_NAV_TAB, res)
|
||||
}
|
||||
}
|
||||
const mutations = {
|
||||
[types.PUBLIC_OBJ] (state, res) {
|
||||
state.publicObj = res
|
||||
},
|
||||
[types.PUBLIC_ARR] (state, res) {
|
||||
state.publicArr = res
|
||||
},
|
||||
[types.SET_NAV_TAB] (state, res) {
|
||||
state.navTab = res
|
||||
}
|
||||
}
|
||||
export default {
|
||||
state,
|
||||
getters,
|
||||
actions,
|
||||
mutations
|
||||
}
|
||||
Reference in New Issue
Block a user