This works, but I need to use mounted(){} to initiate the function which I think can be avoided but not sure how. This code doesn’t work, but I like to do something like this. Initiating the function in data(){} itself. Thanks in advance. Answer I agree with Decade Moon that your first approach is the better way to do it
Tag: vue-resource
Vue.js – How to properly watch for nested data
I’m trying to understand how to properly watch for some prop variation. I have a parent component (.vue files) that receive data from an ajax call, put the data inside an object and use it to render some child component through a v-for directive, below a simplification of my implementation: … then inside <script> tag: item objects are like this:
Include global functions in Vue.js
In my Vue.js application I want to have some global functions. For example a callApi() function which I can call every time I need access to my data. What is the best way to include these functions so I can access it in all my components? Should I create a file functions.js and include it in my main.js? Should I