@eliashdezr
In router.js:
const router = new VueRouter({ ... })
router.beforeEach((to, from, next) => {
// ...
})
export default router
Not sure I understand the beginning of your question. You don’t have to import router wherever you are using it. It’s injected into VM’s through $router object – so you can use it in Vue <template> and <script> tags.