html
<div class="content">
<component :is="dom[tabHtml]"></component>
</div>
import
import { shallowReactive } from 'vue'
import Home from '@/components/home/Home.vue';
js
<script setup lang="ts">
const tabHtml = ref('');
//设置不同组件import引入
const dom = shallowReactive<any>({
Home,
})
//切换路由标签
const changeTab = (id: number,html?:any) => {
activeTab.value = id;
tabHtml.value = html
}
</script>