Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/api/global-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -451,3 +451,26 @@ const app = createApp({
```

**See also**: [`$nextTick` instance method](instance-methods.html#nexttick)

## mergeProps

Takes multiple objects containing VNode props and merges them into a single object. A newly created object is returned, the objects passed as arguments are not modified.

Any number of objects can be passed, with properties from later arguments taking precedence. Event listeners are handled specially, as are `class` and `style`, with the values of these properties being merged rather than overwritten.

```js
import { h, mergeProps } from 'vue'

export default {
inheritAttrs: false,

render() {
const props = mergeProps({
// The class will be merged with any class from $attrs
class: 'active'
}, this.$attrs)

return h('div', props)
}
}
```