<template> <div ref="ref_dom" class="gis-overlay-default"> <template v-if="comCpt?.com"> <Component :is="comCpt.com"/> </template> </div> </template> <script lang="ts"> import { defineComponent, computed, onMounted, ref, reactive, watch, getCurrentInstance, ComponentInternalInstance, toRefs, nextTick, markRaw } from 'vue' import {useStore} from 'vuex' import {useRouter, useRoute} from 'vue-router' import {ElMessage, ElMessageBox} from "element-plus"; import SbCom from './sb.vue' import JqCom from './jq.vue' import LgCom from './lg.vue' import CzwCom from './czw.vue' import HczCom from './hcz.vue' export default defineComponent({ name: '', components: { SbCom, JqCom, LgCom, CzwCom, HczCom, }, props: {}, setup(props, {emit}) { const store = useStore(); const router = useRouter(); const route = useRoute(); const that = (getCurrentInstance() as ComponentInternalInstance).appContext.config.globalProperties const state = reactive({ comps: [ {label: '设备', value: 'sb', com: markRaw(SbCom)}, {label: '景区', value: 'jq', com: markRaw(JqCom)}, {label: '旅馆', value: 'lg', com: markRaw(LgCom)}, {label: '出租屋', value: 'czw', com: markRaw(CzwCom)}, {label: '火车站', value: 'hcz', com: markRaw(HczCom)}, ] }) const comCpt = computed(() => { return state.comps.filter(v => v.value === store.state.gis.gisParams.default.type)?.[0] }) const ref_dom = ref() onMounted(() => { }) return { ...toRefs(state), comCpt, ref_dom } }, }) </script> <style scoped lang="scss"> </style>