How to use defineProps/defineEmits/defineModel with defineComponent JSX/TSX approach? #8758
Unanswered
Maxim-Mazurok
asked this question in
Help/Questions
Replies: 3 comments 1 reply
-
You can use |
Beta Was this translation helpful? Give feedback.
1 reply
-
I have the same problem |
Beta Was this translation helpful? Give feedback.
0 replies
-
defineProps...Apis are only happened in compile-time, which is not a actually function, so you cannot use out of sfc 😢 . |
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
-
My components look like this:
I'm using JSX/TSX syntax with Vue 3 Composition API.
As you can see, the only thing using Options API is
props
. I'd like to usedefineProps()
instead, like so:However, I'm always getting
defineProps is not defined
error during runtime. I've tried using type-only definition, same issue.I also couldn't find any example of defineProps used with defineComponent, only examples I could find were using Options API to define props.
So is it at all possible to use these new shiny
defineProps/defineEmits/defineModel
methods in JSX/TSX syntax? I'm using latestvite
and latestvue
.Beta Was this translation helpful? Give feedback.
All reactions