35 lines
931 B
JavaScript
35 lines
931 B
JavaScript
/**
|
||
* 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 |