refactor: migrate vue router config
This commit is contained in:
parent
b63a14d8ce
commit
579e57f631
2 changed files with 43 additions and 50 deletions
|
@ -1,50 +0,0 @@
|
||||||
import { createRouter, createWebHistory } from "vue-router";
|
|
||||||
import Home from "../views/Home.vue";
|
|
||||||
|
|
||||||
const routes = [
|
|
||||||
{
|
|
||||||
path: "/",
|
|
||||||
name: "Home",
|
|
||||||
component: Home,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/general",
|
|
||||||
name: "General",
|
|
||||||
component: () =>
|
|
||||||
import(/* webpackChunkName: "general" */ "@/views/General.vue"),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/anatomy",
|
|
||||||
name: "Anatomy",
|
|
||||||
component: () =>
|
|
||||||
import(/* webpackChunkName: "anatomy" */ "@/views/Anatomy.vue"),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/clothing",
|
|
||||||
name: "Clothing",
|
|
||||||
component: () =>
|
|
||||||
import(/* webpackChunkName: "clothing" */ "@/views/Clothing.vue"),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/abilities",
|
|
||||||
name: "Abilities",
|
|
||||||
component: () =>
|
|
||||||
import(/* webpackChunkName: "abilities" */ "@/views/Abilities.vue"),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/overdrive",
|
|
||||||
name: "Overdrive",
|
|
||||||
component: () =>
|
|
||||||
import(/* webpackChunkName: "overdrive" */ "@/views/Overdrive.vue"),
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
const router = createRouter({
|
|
||||||
history: createWebHistory(process.env.BASE_URL),
|
|
||||||
routes,
|
|
||||||
scrollBehavior() {
|
|
||||||
return { top: 0 };
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export default router;
|
|
43
src/router/index.ts
Normal file
43
src/router/index.ts
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
import { createRouter, createWebHistory } from "vue-router";
|
||||||
|
import HomeView from "@/views/HomeView.vue";
|
||||||
|
|
||||||
|
const router = createRouter({
|
||||||
|
history: createWebHistory(import.meta.env.BASE_URL),
|
||||||
|
scrollBehavior() {
|
||||||
|
return { top: 0, behavior: "smooth" };
|
||||||
|
},
|
||||||
|
routes: [
|
||||||
|
{
|
||||||
|
path: "/",
|
||||||
|
name: "home",
|
||||||
|
component: HomeView,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/general",
|
||||||
|
name: "general",
|
||||||
|
component: () => import("@/views/GeneralView.vue"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/anatomy",
|
||||||
|
name: "anatomy",
|
||||||
|
component: () => import("@/views/AnatomyView.vue"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/clothing",
|
||||||
|
name: "clothing",
|
||||||
|
component: () => import("@/views/ClothingView.vue"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/abilities",
|
||||||
|
name: "abilities",
|
||||||
|
component: () => import("@/views/AbilitiesView.vue"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/overdrive",
|
||||||
|
name: "overdrive",
|
||||||
|
component: () => import("@/views/OverdriveView.vue"),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
export default router;
|
Loading…
Add table
Add a link
Reference in a new issue