u
This commit is contained in:
1 parent
d1b1aafc57
commit
0f1604c709
58 files changed
+15476
-25
No files matched your search
@@ -0,0 +1,24 @@
|
||||
import type { App } from "vue";
|
||||
import { createRouter, createWebHashHistory } from "vue-router";
|
||||
import routes from "./routes";
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHashHistory(),
|
||||
strict: true,
|
||||
routes: routes,
|
||||
scrollBehavior: () => ({ left: 0, top: 0 }),
|
||||
});
|
||||
|
||||
router.beforeEach((to, from, next) => {
|
||||
window.NProgress?.start?.();
|
||||
|
||||
next();
|
||||
});
|
||||
|
||||
router.afterEach(() => {
|
||||
window.NProgress?.done?.();
|
||||
});
|
||||
|
||||
export function setupRouter(app: App) {
|
||||
app.use(router);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import { RouteRecordRaw } from "vue-router";
|
||||
|
||||
import BaseLayout from "@/layouts/base-layout/index.vue";
|
||||
import Home from "@/pages/home/index.vue";
|
||||
import AboutUs from "@/pages/aboutUs/index.vue";
|
||||
const routes: RouteRecordRaw[] = [
|
||||
{
|
||||
path: "/",
|
||||
component: BaseLayout,
|
||||
redirect: "/home",
|
||||
children: [
|
||||
{
|
||||
path: "/home",
|
||||
component: Home
|
||||
},
|
||||
{
|
||||
path: "/aboutUs",
|
||||
component: AboutUs
|
||||
},
|
||||
|
||||
]
|
||||
},
|
||||
|
||||
];
|
||||
|
||||
export default routes;
|
||||
Reference in new issue
Block a user