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

Bind methods to scope #74

Merged
merged 2 commits into from
Sep 14, 2021
Merged

Bind methods to scope #74

merged 2 commits into from
Sep 14, 2021

Conversation

Fry98
Copy link
Contributor

@Fry98 Fry98 commented Aug 30, 2021

Methods inside a scope aren't bound to it which causes issues when they're used as a callback (e.g. for setInterval, window events, etc.).

Example: https://codesandbox.io/embed/nice-sun-71j3r
(this.count should get incremented on keydown but it doesn't because this inside the inc() methods points to Window instead of the scope)

@yyx990803 yyx990803 merged commit 167c49d into vuejs:main Sep 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants