1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
| import { createStore } from 'vuex'; //导入createStore构造函数
| export default createStore({
| state: {
| //Vuex的状态,实际上就是存数据的地方
| setSearchData: false,
| setCellItem: null,
| setShowCellItem: false,
| setMenuFlag: null,
| setBaseLayerFlag: null,
| setRefreshFlag: true,
| setLoadFlag: false,
| setMapRefreashFlag: false
| },
| getters: {
| //提供获取Vux状态的方式, 注意在组件中调用时getPerson是以属性的方式被访问
| },
| mutations: {
| //提供直接操作Vuex的方法,注意mutations里的方法中不能有任何异步操做
| },
| actions: {
| //提供通过mutations方法来简介操作Vuex的方法
| }
| });
|
|