<template>
    <div>
        <button @click="currentComponent = ComponentA">Load Component A</button>
        <button @click="currentComponent = ComponentB">Load Component B</button>
        <component :is="currentComponent"></component>
    </div>
</template>

<script setup>
import ComponentA from '../components/ComponentA.vue';
import ComponentB from '../components/ComponentB.vue';

import { shallowRef } from 'vue'

let currentComponent = shallowRef(ComponentA)

</script>

Logo

前往低代码交流专区

更多推荐