index.ts 869 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. import { createApp } from 'vue';
  2. import App from '../App.vue';
  3. import { createPinia } from 'pinia';
  4. import piniaPluginPersistedstate from 'pinia-plugin-persistedstate';
  5. const pinia = createPinia();
  6. pinia.use(piniaPluginPersistedstate);
  7. let app = createApp(App);
  8. app.use(pinia);
  9. import {
  10. defineStore
  11. } from 'pinia';
  12. export const Store = defineStore({
  13. id: 'layerId',//命名
  14. state: () => {
  15. return {
  16. queryMapTables: [],//地图查询表
  17. roleId: '',//用户权限ID
  18. realName: '',//登录账号的用户名
  19. layerID: '',//控制唯一底图加载id
  20. markID: '',//控制标注id
  21. keepAlives: ['Map3DMain'],//控制加载缓存页面
  22. userport: '',
  23. jt3d: {},//地图实例
  24. isflyto:false
  25. }
  26. },
  27. getters: {
  28. keepAlive(state) {
  29. return state.keepAlives
  30. }
  31. },
  32. actions: {
  33. setLayerID(index) {
  34. this.layerID = index
  35. }
  36. },
  37. persist: true
  38. })