Replies: 1 comment
-
Don't use names, use the Component object directly. <script setup>
import ComponentA from './ComponentA.vue'
import ComponentB from './ComponentB.vue'
const componentName = ref()
function toggleComponent() {
componentName.value = componentName.value === ComponentA
? ComponentB
: ComponentA
}
</script> |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
<template> <component :is="componentName"></component> </template>
How to register component with name in < script setup> to make a active component ?
Beta Was this translation helpful? Give feedback.
All reactions