daShangDao_miniProgram/store/index.js
2026-06-15 16:37:57 +08:00

35 lines
931 B
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* Vuex Store - 全局状态管理入口
*
* 模块拆分说明:
* - auth: 用户认证token、userInfo、登录状态
* - price: 价格配置priceMode、priceType、运费等
* - warehouse: 仓库管理(仓库选择、仓库列表)
*
* 使用方式:
* - 命名空间访问this.$store.state.auth.token
* - 辅助函数import { mapState, mapMutations, mapActions, mapGetters } from 'vuex'
* - mapState('auth', ['token', 'isLogin'])
* - mapMutations('price', ['updatePriceMode'])
* - mapActions('auth', ['wechatLogin', 'logout'])
* - mapGetters('warehouse', ['selectedWarehouse'])
*/
import Vue from 'vue'
import Vuex from 'vuex'
// 导入子模块
import auth from './modules/auth'
import price from './modules/price'
import warehouse from './modules/warehouse'
Vue.use(Vuex)
const store = new Vuex.Store({
modules: {
auth,
price,
warehouse
}
})
export default store