2021-04-20 07:55:42 +02:00

28 lines
522 B
JavaScript

import Vue from 'vue'
import VueRouter from 'vue-router'
import routes from './routes'
Vue.use(VueRouter)
// configure router
const router = new VueRouter({
routes, // short for routes: routes
linkActiveClass: 'active',
mode: 'history',
scrollBehavior: (to, from, savedPosition) => {
if (savedPosition) {
return savedPosition
}
if (to.hash) {
return { selector: to.hash }
}
return { x: 0, y: 0 }
},
})
router.beforeEach((to, from, next) => {
next()
})
export default router