import VueRouter from 'vue-router';
import { routes } from './routes.js';

const router = new VueRouter({
  mode: 'history',
  base: '/welfare/',
  routes,
  scrollBehavior(to, from, savedPosition) {
    if (savedPosition && to.meta.keepAlive) {
      return savedPosition;
    }
    document.documentElement.scrollTop = 0;
  }
});

// router.beforeEach((to, from, next) => {
//   console.log(to);
//   next();
// })

export default router;
