Subscribe on changes!

$attrs fall through to child components and override explicitly defined props

avatar
Aug 11th 2021

Version

3.2.1

Reproduction link

Link

Steps to reproduce

Nothing necessary

What is expected?

Since ParentComponent does not have any props defined and does not bind $attrs to the ChildComponent the ChildComponent should receive the value of some-prop as defined in the ParentComponent.

What is actually happening?

The value from App.vue falls through to ChildComponent and overrides the explicitly passed prop in ParentComponent.

avatar
Aug 11th 2021

you should:

export default {
+  inheritAttrs:false,
  components: {
    ChildComponent,
  },
};

see https://v3.vuejs.org/api/options-misc.html#inheritattrs