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>
