feat: 调整布局

This commit is contained in:
duanshuwen
2025-12-07 16:29:57 +08:00
parent 14d916187c
commit 84300791a0
19 changed files with 564 additions and 146 deletions

View File

@@ -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) => {