'add'
parent
1c90c76864
commit
5f893153d4
@ -0,0 +1,5 @@
|
|||||||
|
export default {
|
||||||
|
changeCity(ctx, city) {
|
||||||
|
ctx.commit('changeCity', city)
|
||||||
|
}
|
||||||
|
}
|
@ -1,21 +1,14 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import Vuex from 'vuex'
|
import Vuex from 'vuex'
|
||||||
|
import state from './state'
|
||||||
|
import mutations from './mutations'
|
||||||
|
import actions from './actions'
|
||||||
|
|
||||||
Vue.use(Vuex)
|
Vue.use(Vuex)
|
||||||
|
|
||||||
// 导出vuex,创建一个仓库store
|
// 导出vuex,创建一个仓库store
|
||||||
export default new Vuex.Store({
|
export default new Vuex.Store({
|
||||||
state: {
|
state,
|
||||||
city: '杭州'
|
actions,
|
||||||
},
|
mutations
|
||||||
actions: {
|
|
||||||
changeCity(ctx, city) {
|
|
||||||
ctx.commit('changeCity', city)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mutations: {
|
|
||||||
changeCity(state, city) {
|
|
||||||
state.city = city;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
@ -0,0 +1,5 @@
|
|||||||
|
export default {
|
||||||
|
changeCity(state, city) {
|
||||||
|
state.city = city;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
export default {
|
||||||
|
city: '杭州'
|
||||||
|
}
|
Loading…
Reference in New Issue