Vue js Ready function is not triggered
I see that you are using Vue 2.0.1. There is no ready
method in Vue 2.0 and above.
Here is the link to list of all Vue 2.0 changes: https://github.com/vuejs/vue/issues/2873
As mentioned in the page above, you can use mounted
instead of ready
.
Not an issue, but just a note: You are mixing jQuery and Vue extensively. If you need jQuery only for http related functions, you may instead use vue-resource
- https://github.com/vuejs/vue-resource
EDIT: Update on vue-resource
As pointed out by @EmileBergeron in the comments, vue-resource was retired way back in November 2016 itself (few weeks after I provided this answer with that last paragraph on vue-resource
). Here is more info on the same:
https://medium.com/the-vue-point/retiring-vue-resource-871a82880af4
@Mani's suggestion of using mounted(){}
works on the component that's not hidden. If you like to run a function in the component when visible and the elements which are hidden using conditions like v-if=""
or v-show=""
then use updated(){}
.