src/router/main.ts
参考示例,提前写好一个用于展示的页面放到src/pages/404.vue
import { createRouter, createWebHashHistory } from 'vue-router/auto'
import { setupLayouts } from 'virtual:generated-layouts'
import { routes } from 'vue-router/auto-routes'
const router = createRouter({
history: createWebHashHistory(import.meta.env.BASE_URL),
routes: [
...setupLayouts(routes),
{
path: '/:pathMatch(.*)*',
name: 'NotFound',
component: () => import('@/pages/404.vue')
}
],
})
router.isReady().then(() => {
localStorage.removeItem('vuetify:dynamic-reload')
})
export default router