1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
| // src/stores/useUserStore.js
| import { defineStore } from 'pinia'
|
| export const useMap = defineStore('map', {
| // 存储状态的地方,相当于 Vuex 的 state
| state: () => ({
| loadMap: false
| }),
|
| // 相当于 Vuex 的 getters,用于计算状态
| getters: {
|
| },
|
| // 相当于 Vuex 的 mutations 和 actions,用于同步或异步地修改状态
| actions: {
| setLoadMap (flag) {
| this.loadMap = flag
| },
| }
| })
|
|