Commit 915faa8a by huangqy

小修改

parent d290c8bf
import { createApp } from 'vue'
import App from './App.vue'
import router from './router/index';
createApp(App).mount('#app')
// 链式注册插件
const app = createApp(App).use(router);
// 现在所有的导航都是异步的,等路由ready以后再进行挂载组件;
router.isReady().then(() => app.mount('#app'));
// 在导航期间每次发生未捕获的错误时都会调用该处理程序
router.onError((err) => { console.error(err); });
......@@ -2,6 +2,7 @@ import {
createRouter, createWebHashHistory, RouteRecordRaw,
} from 'vue-router';
// 静态路由
export const constantRouterMap: Array<RouteRecordRaw> = [
{
path: '/',
......@@ -10,6 +11,11 @@ export const constantRouterMap: Array<RouteRecordRaw> = [
}
]
// 异步路由
export const asyncRoutes: Array<RouteRecordRaw> = [
]
const router = createRouter({
history: createWebHashHistory(), // hash模式:createWebHashHistory,history模式:createWebHistory
scrollBehavior: () => ({ // 切换路由, 始终滚动到顶部
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论