import * as vueRouter from 'vue-router'
import { createRouter } from 'vue-router'
import generatedRoutes from '~pages'

// 导出路由
const routes = generatedRoutes
console.log(routes)
const router = createRouter({
  history: vueRouter.createWebHistory(),
  routes
})

router.beforeEach((to, from, next) => {
  if (to.matched.length) {
    next()
  } else {
    console.log('404')
  }
})

export default router
