I'm using Webpack bundler to serve Vue 2.0 based frontend. The problem is that method ready
in components doesn't get called. Do I need to add some extra watch on component or something like that?
My router:
import Vue from 'vue'
import VueRouter from 'vue-router'
import VueResource from 'vue-resource'
import Register from './views/auth/register.vue'
Vue.use(VueRouter);
Vue.use(VueResource);
const routes = [
{ path: '/auth/register', component: Register }
]
const router = new VueRouter({
routes // short for routes: routes
})
export default router;
and my sample component:
<template>
<div>
<div class="message">{{ msg }}</div>
</div>
</template>
<script>
export default {
data: function () {
return {
msg: 'Hello from vue-loader!'
}
},
ready: function() {
console.log('test');
}
}
</script>
ready()
lifecycle hook method is depracated in VueJS 2.0.x.Use mounted()
or created()
instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With