see my demo, I hope hook component ready with following code:
JavaScript
x
15
15
1
<body>
2
<div id="app">
3
<ro-tag></ro-tag>
4
</div>
5
<script>
6
Vue.component("ro-tag", {
7
ready: function () {
8
console.log("ready")
9
},
10
template: "<div></div>"
11
})
12
new Vue({el: "#app"})
13
</script>
14
</body>
15
the ready function isn’t invoked.
Advertisement
Answer
ready
has been replaced with mounted hook in vue 2.x.x. you can use mounted hook which gets:
Called after the instance has just been mounted where el is replaced by the newly created vm.$el
see updated fiddle.