index.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <template>
  2. <div ref="ref_dom" class="gis-overlay-default">
  3. <template v-if="comCpt?.com">
  4. <Component :is="comCpt.com"/>
  5. </template>
  6. </div>
  7. </template>
  8. <script lang="ts">
  9. import {
  10. defineComponent,
  11. computed,
  12. onMounted,
  13. ref,
  14. reactive,
  15. watch,
  16. getCurrentInstance,
  17. ComponentInternalInstance,
  18. toRefs,
  19. nextTick, markRaw
  20. } from 'vue'
  21. import {useStore} from 'vuex'
  22. import {useRouter, useRoute} from 'vue-router'
  23. import {ElMessage, ElMessageBox} from "element-plus";
  24. import SbCom from './sb.vue'
  25. import JqCom from './jq.vue'
  26. import LgCom from './lg.vue'
  27. import CzwCom from './czw.vue'
  28. import HczCom from './hcz.vue'
  29. export default defineComponent({
  30. name: '',
  31. components: {
  32. SbCom,
  33. JqCom,
  34. LgCom,
  35. CzwCom,
  36. HczCom,
  37. },
  38. props: {},
  39. setup(props, {emit}) {
  40. const store = useStore();
  41. const router = useRouter();
  42. const route = useRoute();
  43. const that = (getCurrentInstance() as ComponentInternalInstance).appContext.config.globalProperties
  44. const state = reactive({
  45. comps: [
  46. {label: '设备', value: 'sb', com: markRaw(SbCom)},
  47. {label: '景区', value: 'jq', com: markRaw(JqCom)},
  48. {label: '旅馆', value: 'lg', com: markRaw(LgCom)},
  49. {label: '出租屋', value: 'czw', com: markRaw(CzwCom)},
  50. {label: '火车站', value: 'hcz', com: markRaw(HczCom)},
  51. ]
  52. })
  53. const comCpt = computed(() => {
  54. return state.comps.filter(v => v.value === store.state.gis.gisParams.default.type)?.[0]
  55. })
  56. const ref_dom = ref()
  57. onMounted(() => {
  58. })
  59. return {
  60. ...toRefs(state),
  61. comCpt,
  62. ref_dom
  63. }
  64. },
  65. })
  66. </script>
  67. <style scoped lang="scss">
  68. </style>