see my demo, I hope hook component ready with following code:
<body>
<div id="app">
<ro-tag></ro-tag>
</div>
<script>
Vue.component("ro-tag", {
ready: function () {
console.log("ready")
},
template: "<div></div>"
})
new Vue({el: "#app"})
</script>
</body>
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.