feat: 调整布局
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { createRouter, createWebHistory } from "vue-router";
|
||||
import Layout from '@/layout/index.vue'
|
||||
|
||||
const routes = [
|
||||
{
|
||||
@@ -13,16 +14,52 @@ const routes = [
|
||||
meta: { requiresAuth: true },
|
||||
},
|
||||
{
|
||||
path: "/home",
|
||||
name: "Home",
|
||||
component: () => import("@/views/home/index.vue"),
|
||||
meta: { requiresAuth: true },
|
||||
},
|
||||
{
|
||||
path: "/rate",
|
||||
name: "Rate",
|
||||
component: () => import("@/views/rate/index.vue"),
|
||||
meta: { requiresAuth: true },
|
||||
path: "/",
|
||||
component: Layout,
|
||||
children: [
|
||||
{
|
||||
path: "home",
|
||||
component: () => import("@/views/home/index.vue"),
|
||||
name: "Home",
|
||||
meta: { requiresAuth: true },
|
||||
},
|
||||
{
|
||||
path: "stock",
|
||||
name: "Stock",
|
||||
component: () => import("@/views/stock/index.vue"),
|
||||
meta: { requiresAuth: true },
|
||||
},
|
||||
{
|
||||
path: "rate",
|
||||
name: "Rate",
|
||||
component: () => import("@/views/rate/index.vue"),
|
||||
meta: { requiresAuth: true },
|
||||
},
|
||||
{
|
||||
path: "order",
|
||||
name: "Order",
|
||||
component: () => import("@/views/order/index.vue"),
|
||||
meta: { requiresAuth: true },
|
||||
},
|
||||
{
|
||||
path: "more",
|
||||
name: "More",
|
||||
component: () => import("@/views/more/index.vue"),
|
||||
meta: { requiresAuth: true },
|
||||
},
|
||||
{
|
||||
path: "setting",
|
||||
name: "Setting",
|
||||
component: () => import("@/views/setting/index.vue"),
|
||||
meta: { requiresAuth: true },
|
||||
},
|
||||
{
|
||||
path: "/dashboard",
|
||||
name: "Dashboard",
|
||||
component: () => import("@/views/dashboard/index.vue"),
|
||||
meta: { requiresAuth: true },
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
path: "/about",
|
||||
@@ -34,6 +71,13 @@ const routes = [
|
||||
const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes,
|
||||
scrollBehavior(to: any, from: any, savedPosition: any) {
|
||||
if (savedPosition) {
|
||||
return savedPosition
|
||||
}
|
||||
|
||||
return { top: 0 }
|
||||
},
|
||||
});
|
||||
|
||||
router.beforeEach((to: any, from: any, next: any) => {
|
||||
|
||||
Reference in New Issue
Block a user