Vue-வின் <component :is> உங்களை இயக்க நேரத்தில் முடிவு செய்யப்பட்ட மாறிடத்தை வரைய அனுமதிக்கிறது, மற்றும் <KeepAlive> இந்த மாறிடங்களை ஏற்றி வைத்து அவற்றுடைய நிலை பாதுகாக்கிறது.
<component :is> உடன் கிரியாசக்த மாறிடங்கள்
<script setup>
import { ref, shallowRef } from "vue";
import TabHome from "./TabHome.vue";
import TabProfile from "./TabProfile.vue";
const tabs = { home: TabHome, profile: TabProfile };
const current = shallowRef(TabHome); // which component to show
</script>
<template>
<button @click="current = tabs.home">Home</button>
<button @click="current = tabs.profile">Profile</button>
<component :is="current" /> <!-- renders whichever component `current` holds -->
</template>
