Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inheritAttrs: false does not work in a mixin #3741

Closed
emccorson opened this issue May 7, 2021 · 1 comment · Fixed by #3742
Closed

inheritAttrs: false does not work in a mixin #3741

emccorson opened this issue May 7, 2021 · 1 comment · Fixed by #3742
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. 🐞 bug Something isn't working

Comments

@emccorson
Copy link

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

@posva
Copy link
Member

posva commented May 7, 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 😉

@HcySunYang HcySunYang added 🐞 bug Something isn't working 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. labels May 8, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Oct 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. 🐞 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants