Reputation: 1439
I'm trying to redirect the url using router.push({ path: 'customers', query : mergedQuery });
but I can't get a correct reference to router
property.
I feel like I'm missing something in the app.js but not sure which one. Inside component this.$route
has some stuff inside it but there's no router
property.
app.js
window.Vue = require('vue');
window.VueRouter = require('vue-router');
window.VueResource = require('vue-resource');
window.Vue.use(window.VueRouter);
const routes = [
{ path: '/', component: require('./components/dashboard.vue') },
{ path: '/customers/', component: require('./components/customers/list.vue') },
];
const router = new VueRouter({routes});
const app = new Vue({router}).$mount('#app');
.vue file
console.log(this.$route.router); //undefined
Upvotes: 1
Views: 5763
Reputation: 2348
You're accessing it incorrectly. According to the official docs, router is available inside component instances as this.$router
.
Upvotes: 2