初始化

This commit is contained in:
robin
2022-07-07 22:24:46 +08:00
commit 72b69615b6
42 changed files with 10068 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
/*
* */
import Vuex from 'vuex'
export default (Vue) => {
Vue.use(Vuex);
const store = require("./store")
return {
name : "store",
value: store.default
}
}
+39
View File
@@ -0,0 +1,39 @@
import Vuex from 'vuex'
const state = {
count: 1
}
const mutations = {
SET_ADD_COUNT : (state) => {
state.count++
},
SET_SUBTRACT_COUNT: (state) => {
state.count--
}
}
const actions = {
// 加
add({commit}) {
commit('SET_ADD_COUNT')
},
// 减
subtract({commit}) {
commit('SET_SUBTRACT_COUNT')
}
}
const store = new Vuex.Store({
modules: {
//封装的存放state下count的方法
app: {
// namespaced: true,
state,
mutations,
actions
}
}
})
export default store