Skip to content

docs: add mergeProps behavior note to props guide#3403

Open
whysopaul wants to merge 1 commit into
vuejs:mainfrom
whysopaul:patch-1
Open

docs: add mergeProps behavior note to props guide#3403
whysopaul wants to merge 1 commit into
vuejs:mainfrom
whysopaul:patch-1

Conversation

@whysopaul
Copy link
Copy Markdown

Description of Problem

When combining explicit bindings (e.g. @click) with a v-bind object on a component, Vue internally uses mergeProps() to combine them. The merging strategy is asymmetric: regular props are overwritten by the last value, while event listeners, class, and style are merged. This behavior is not documented in the Components Props guide, leaving users without explanation for why multiple handlers fire unexpectedly.

Proposed Solution

Add a "Merge Behavior When Combining Bindings" subsection to the "Prop Passing Details" section of the Props guide, where the reader already has the right context. The note covers the asymmetric merge strategy and links to the existing documentation in the Render Function API reference and Fallthrough Attributes guide.

Additional Information

The merging rules are already documented in the mergeProps() API reference and partially in Fallthrough Attributes, but neither of those sections addresses the case of explicit v-bind usage in a parent template.

…t bindings

When a component receives bindings from multiple sources — explicit `@event` listeners and a `v-bind` object — Vue internally uses `mergeProps()` to combine them. The merging strategy is asymmetric: regular props are overwritten by the last value, while event listeners, `class`, and `style` are merged. This behavior is only documented in the Render Function API reference, but users are most likely to encounter it in the context of `v-bind` on components.

This PR adds a note to the "Binding Multiple Properties Using an Object" section of the Props guide, where the reader already has the right context.
@netlify
Copy link
Copy Markdown

netlify Bot commented May 30, 2026

Deploy Preview for vuejs ready!

Name Link
🔨 Latest commit d935c34
🔍 Latest deploy log https://app.netlify.com/projects/vuejs/deploys/6a1b1e97e989f7000837935e
😎 Deploy Preview https://deploy-preview-3403--vuejs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant