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