You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi. I agree with the issue that in the Tree Example, there are direct mutations of props - specifically, props.model.children.push(...) and props.model.children = []. This violates Vue’s principle of one-way data flow, where props are meant to be treated as immutable.
It's likely that this approach was chosen intentionally to keep the example concise and focused.
However, it might be beneficial to either:
include a comment in the example clarifying that the prop mutation is used for simplicity and not recommended in production code, or
update the example to follow Vue’s best practices, using local state or event emission instead.
I can help refactor the example if needed. What do you think?
https://cn.vuejs.org/guide/components/props.html#mutating-object-array-props
The text was updated successfully, but these errors were encountered: