0👍
It looks like you aren’t injecting your router into your app, hence it being ‘undefined’
To inject the router make following changes in the Vue app in app.js:
const app = new Vue({
el: '#app',
router // inject the router
});
After that you can use this.$router
throughout the app.
Other approach:
You have to import router
from app.js
like following:
import router from ‘./path/to/app
and after that you can simply use:
router.push
Source:stackexchange.com