Closed ewilan-riviere closed 2 years ago
Seems like 'component` is a reserved key word on template setup syntax ? It works with different variable name :
<script setup lang="ts">
import { ref } from '@nuxtjs/composition-api'
const tag = ref('button')
</script>
Note : idk if it's only me, but I was forced to add import { ref } from '@nuxtjs/composition-api'
...
Note 2 : no need of this ugly import after migrate to the new Nuxt Bridge (beta) !
Discussion : #585
See (pretty heavy) migration guide : https://v3.nuxtjs.org/getting-started/bridge/
For auto import like ref
, I use https://github.com/antfu/unplugin-auto-import, it's really amazing ;)
It's work perfectly, thanks! I didn't know component
is reserved I should have checked ^^'
I will migrate soon to Bridge, need to migrate my components to script setup before that :D
Very thx @ewilan-riviere, didn't known that this @antfu plugin worked in Nuxt too ! It seems a far cleaner solution than Nuxt Bridge, at least for now đ
đ What are you trying to do? Please describe.
I want to use
<component>
to create a dynamic component. When I use Vue 2 syntax, everything works but when I usescript setup
syntax, I have an errorcomponent is not defined
.đ What have you tried?
With Vue 2 syntax, it works:
With
script setup
syntax, I have an error:âšī¸ Additional context