Vue: data method not called with `this` as argument when using mixins with data option

Created on 6 Dec 2017  ·  4Comments  ·  Source: vuejs/vue



Reproduction link

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


All 4 comments

Please use this to access component instance in hooks and other methods.

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

I'm on a PR.

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yuu2lee4 picture yuu2lee4  ·  4Comments

patrickhousley picture patrickhousley  ·  4Comments

AmrIKhudair picture AmrIKhudair  ·  3Comments

siavashkavousi picture siavashkavousi  ·  3Comments

indus picture indus  ·  3Comments