mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-20 07:30:57 +00:00
docs: mention #components
import for dynamic component (#22231)
This commit is contained in:
parent
1f1de38d03
commit
6c517e919c
@ -98,17 +98,20 @@ This registers the components using the same strategy as used in Nuxt 2. For exa
|
||||
|
||||
## Dynamic Components
|
||||
|
||||
If you want to use the Vue `<component :is="someComputedComponent">` syntax, then you will need to use the `resolveComponent` helper provided by Vue.
|
||||
If you want to use the Vue `<component :is="someComputedComponent">` syntax, you need to use the `resolveComponent` helper provided by Vue or import the component directly from `#components` and pass it into `is` prop.
|
||||
|
||||
For example:
|
||||
|
||||
```vue
|
||||
<script setup lang="ts">
|
||||
import { SomeComponent } from '#components'
|
||||
|
||||
const MyButton = resolveComponent('MyButton')
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<component :is="clickable ? MyButton : 'div'" />
|
||||
<component :is="SomeComponent" />
|
||||
</template>
|
||||
```
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user