diff --git a/superMarket-frontend/src/store/index.js b/superMarket-frontend/src/store/index.js index 129cadb..cd1e007 100644 --- a/superMarket-frontend/src/store/index.js +++ b/superMarket-frontend/src/store/index.js @@ -1,18 +1,29 @@ import Vue from 'vue' +// 导入 Vue 框架 + import Vuex from 'vuex' +// 导入 Vuex 状态管理库 Vue.use(Vuex) +// 注册 Vuex 插件,使其可以在 Vue 中使用 export default new Vuex.Store({ +// 导出一个新的 Vuex.Store 实例 state: { + // 定义状态对象,用于存储全局状态 BaseApi: "http://localhost:9291" + // 定义 BaseApi 属性,存储 API 的基础地址 }, getters: { + // 定义 getters 对象,用于从 state 中派生数据 }, mutations: { + // 定义 mutations 对象,用于同步修改 state }, actions: { + // 定义 actions 对象,用于处理异步操作并提交 mutations }, modules: { + // 定义 modules 对象,用于模块化管理状态 } -}) +}) \ No newline at end of file