yearning
20 小时以前 1d37c375fd114212ee1419c3bbdadc81d76666a4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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(async (to, from, next) => {
  if (!to.matched.length) {
    next({ path: '/error/404', query: { errorUrl: to.fullPath } })
    return
  }
  next()
})
 
export default router