Skip to content

Not sure how to properly approach defineModel with objects #10538

Discussion options

You must be logged in to vote

No. We have 2 options: mutating nested properties of props directly or updating reference to the defineModel's model by shallow copying the original model and reassigning it.

I prefer the 1st option since it is cheaper and less boilerplate'y though against vue principals of not mutating props.

Replies: 10 comments 7 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@HassanDomeDenea
Comment options

@kesoji
Comment options

Comment options

You must be logged in to vote
2 replies
@Gregoor
Comment options

@jaypeerj
Comment options

Comment options

You must be logged in to vote
1 reply
@max-sistemich-kisters
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@paul-geisler
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@GabrielHangor
Comment options

Answer selected by GabrielHangor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet