Subscribe on changes!

`inheritAttrs: false` does not work in a mixin

avatar
May 7th 2021

Version

3.0.11

Reproduction link

https://sfc.vuejs.org/#eyJBcHAudnVlIjoiPHRlbXBsYXRlPlxuICA8TXlDb21wb25lbnQgQG5hdGl2ZS1ldmVudD1cImhhbmRsZU5hdGl2ZUV2ZW50XCIgLz5cbjwvdGVtcGxhdGU+XG5cbjxzY3JpcHQ+XG5pbXBvcnQgTXlDb21wb25lbnQgZnJvbSAnLi9NeUNvbXBvbmVudC52dWUnXG5cbmV4cG9ydCBkZWZhdWx0IHtcbiAgbmFtZTogJ0FwcCcsXG4gIGNvbXBvbmVudHM6IHtcbiAgICBNeUNvbXBvbmVudFxuICB9LFxuICBtZXRob2RzOiB7XG4gICAgaGFuZGxlTmF0aXZlRXZlbnQoKSB7XG4gICAgICBhbGVydCgnVGhlcmUgd2FzIGEgbmF0aXZlIGV2ZW50Jyk7XG4gICAgfVxuICB9XG59XG48L3NjcmlwdD4iLCJNeUNvbXBvbmVudC52dWUiOiI8dGVtcGxhdGU+XG4gIDxidXR0b24gQGNsaWNrPVwiZW1pdE5hdGl2ZUV2ZW50XCI+RW1pdCBuYXRpdmUgZXZlbnQ8L2J1dHRvbj5cbjwvdGVtcGxhdGU+XG5cbjxzY3JpcHQ+XG5jb25zdCBtaXhpbiA9IHtcbiAgaW5oZXJpdEF0dHJzOiBmYWxzZSAgIC8vIDwtLS0tIHRoaXMgZG9lcyBub3Qgd29ya1xufVxuXG5leHBvcnQgZGVmYXVsdCB7XG4gIG5hbWU6ICdNeUNvbXBvbmVudCcsXG4gIC8vaW5oZXJpdEF0dHJzOiBmYWxzZSwgICAgIC8vIDwtLS0tIHRoaXMgZG9lcyB3b3JrXG4gIG1peGluczogWyBtaXhpbiBdLFxuICBtZXRob2RzOiB7XG4gICAgZW1pdE5hdGl2ZUV2ZW50KCkge1xuICAgICAgdGhpcy4kZWwuZGlzcGF0Y2hFdmVudChuZXcgRXZlbnQoJ25hdGl2ZS1ldmVudCcpKTtcbiAgICB9XG4gIH1cbn1cbjwvc2NyaXB0PiJ9

Steps to reproduce

  1. Click the 'Emit native event' button. This will dispatch an event from plain JS.
  2. Notice the alert 'There was a native event' appears. This means the listener on the Vue component was passed to the native element.

What is expected?

inheritAttrs: false should be applied to MyComponent because it has the mixin mixin which sets inheritAttrs: false.

What is actually happening?

The listener on MyComponent is applied to the native element, so inheritAttrs: false is not being applied.


I'm not sure why the SFC Playground link is so massive, but here is the same code in a GitHub repo: https://github.com/emccorson/issue_inherit-attrs-mixin

avatar
May 7th 2021

I'm not sure why the SFC Playground link is so massive, but here is the same code in a GitHub repo:

It's because it contais the whole code in the URL 😉