2.1.0
Call any method inside of data() function
Method should be called (just like in 1.x)
Uncaught TypeError: %method% is not a function is thrown
We are migrating from vue 1.0.28 to 2.x and seems that data() behaviour changed but there's no info in migration guide, vue-migration-helper also says nothing about this. Is this a bug or possibility of calling methods inside data() was removed?
Hey @tzurbaev I am looking for solution, how can we achieve this ?
@mbj36 this bug was fixed in v2.1.4, so you need to update Vue if you're still on old version.
we still cannot call a method within a data?
We can't call it too, on 2.5.21 version
Then why this issue is closed?
This does work. Pay attention to the posted jsfiddle. It opened with Javascript in the "no library (pure JS)" mode. As soon as I picked VueJS 2.2.1 from there (confirmed to work on 2.6.10 as well), it started giving the expected result.
If you still have issues with this in your code, pay special attention to the data object. Like in the posted jsfiddle, it needs to be returned from a function and not directly declared with the Javascript object notation as a property. If you do this, calling functions from within should work as well. You'll easily run into limitations with this though; the VueJS state will be before created() has been called.
Most helpful comment
Then why this issue is closed?