wwf
20 小时以前 e1b028d486713eaf55aaf35fbf334aa568059c0d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { createRouter, createWebHistory } from 'vue-router'
import errorPage from '@/router/error/index.js'
import h5 from '@/router/h5/router.js'
 
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [ ...errorPage, ...h5],
})
 
router.beforeEach((to, from, next) => {
  if (!to.matched.length) {
    if (to.path === '/') {
      next({ path: '/error/404', query: { errorUrl: to.path } })
    }
  } else {
    next()
  }
})
 
export default router