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

data method not called with this as argument when using mixins with data option #7191

Closed
coolzjy opened this issue Dec 6, 2017 · 4 comments · Fixed by #7192
Closed

data method not called with this as argument when using mixins with data option #7191

coolzjy opened this issue Dec 6, 2017 · 4 comments · Fixed by #7192
Labels

Comments

@coolzjy
Copy link
Contributor

coolzjy commented Dec 6, 2017

Version

2.5.9

Reproduction link

https://codepen.io/cool_zjy/pen/KyLpve

Steps to reproduce

  1. run the reproduction
  2. VueComponent logged in console
  3. uncomment // mixins: [mixin],
  4. run the reproduction again

What is expected?

VueComponent logged in console

What is actually happening?

undefined logged in console

@Akryum
Copy link
Member

Akryum commented Dec 6, 2017

Please use this to access component instance in hooks and other methods.
https://codepen.io/Akryum/pen/OOYywd

@Akryum Akryum closed this as completed Dec 6, 2017
@sqal
Copy link
Contributor

sqal commented Dec 6, 2017

@Akryum Why? Since 2.5 data function receives vm instance as the first argument #6760

@posva posva changed the title data method not called with this as argument when using mixins with data option data method not called with this as argument when using mixins with data option Dec 6, 2017
@posva posva reopened this Dec 6, 2017
@posva posva added the bug label Dec 6, 2017
@Akryum
Copy link
Member

Akryum commented Dec 6, 2017

I'm on a PR.

@posva
Copy link
Member

posva commented Dec 6, 2017

I think the fix is adding this as the second arg on call in the mergeDataOrFn function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants