Skip to content

$attrs changes in migration guide #526

Closed
@skirtles-code

Description

@skirtles-code

I can't find this documented anywhere in the migration guide:

https://github.com/vuejs/rfcs/blob/master/active-rfcs/0031-attr-fallthrough.md

Some key points:

  • $listeners has been removed. The listeners will now be included in $attrs by default. Use emits to stop them being included in $attrs.
  • The native modifier has been removed. It is no longer required now that events are included in $attrs.
  • Vue 2 components that were listening for events just so they could re-emit them may not need to do that anymore. Specifically, if the event occurs on the same element that receives the $attrs (the root element by default) the event will already be in the $attrs and doesn't need emitting explicitly. Without changes, Vue 2 components using this pattern will emit the same event twice each time it occurs.
  • class and style are now in $attrs and are not separately applied to the root element. They can be removed from $attrs by listing them in the props.
  • As a result of the changes to $attrs, the setting inheritAttrs has a much greater impact than it did in Vue 2.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions