A little confused about the usage of withDefaults
#6551
RexSkz
started this conversation in
General Discussions
Replies: 2 comments 1 reply
-
good question |
Beta Was this translation helpful? Give feedback.
0 replies
-
The use in Vue3 is from Vue2, Each prop handles its own defaults. |
Beta Was this translation helpful? Give feedback.
1 reply
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.
-
The
withDefaults
functions should be used like this according to the doc (link):We must identify which prop is a primitive and which is a reference. Although we have typings for help, it's still a burden for a newcomer.
I think the "function" may be to prevent multiple components have the same referenced value (
labels
in the example), but why don't we write down the whole 2nd parameter as a function, just like thedata
in Vue 2:Does anyone know why
withDefaults
is not designed like this? Are there any considerations (maybe for compiler optimisation or some special cases)?Beta Was this translation helpful? Give feedback.
All reactions