chore: 重构路由和视图,移除旧的标签页并添加新的布局和页面

This commit is contained in:
2025-12-11 13:25:56 +07:00
parent 508275403a
commit d2b796e434
5 changed files with 31 additions and 27 deletions

View File

@@ -8,19 +8,19 @@ import { ellipse, square, triangle } from "ionicons/icons";
<IonTabs> <IonTabs>
<IonRouterOutlet /> <IonRouterOutlet />
<IonTabBar slot="bottom"> <IonTabBar slot="bottom">
<IonTabButton tab="tab1" href="/tabs/tab1"> <IonTabButton tab="home" href="/layout/home">
<IonIcon aria-hidden="true" :icon="triangle" /> <IonIcon aria-hidden="true" :icon="triangle" />
<IonLabel>Tab 1</IonLabel> <IonLabel>Home</IonLabel>
</IonTabButton> </IonTabButton>
<IonTabButton tab="tab2" href="/tabs/tab2"> <IonTabButton tab="market" href="/layout/market">
<IonIcon aria-hidden="true" :icon="ellipse" /> <IonIcon aria-hidden="true" :icon="ellipse" />
<IonLabel>Tab 2</IonLabel> <IonLabel>Market</IonLabel>
</IonTabButton> </IonTabButton>
<IonTabButton tab="tab3" href="/tabs/tab3"> <IonTabButton tab="user" href="/layout/user">
<IonIcon aria-hidden="true" :icon="square" /> <IonIcon aria-hidden="true" :icon="square" />
<IonLabel>Tab 3</IonLabel> <IonLabel>User</IonLabel>
</IonTabButton> </IonTabButton>
</IonTabBar> </IonTabBar>
</IonTabs> </IonTabs>

View File

@@ -1,31 +1,31 @@
import type { RouteRecordRaw } from "vue-router"; import type { RouteRecordRaw } from "vue-router";
import { createRouter, createWebHistory } from "@ionic/vue-router"; import { createRouter, createWebHistory } from "@ionic/vue-router";
import TabsPage from "../views/TabsPage.vue"; import Layout from "@/components/layout/default.vue";
const routes: Array<RouteRecordRaw> = [ const routes: Array<RouteRecordRaw> = [
{ {
path: "/", path: "/",
redirect: "/tabs/tab1", redirect: "/layout/home",
}, },
{ {
path: "/tabs/", path: "/layout/",
component: TabsPage, component: Layout,
children: [ children: [
{ {
path: "", path: "",
redirect: "/tabs/tab1", redirect: "/layout/home",
}, },
{ {
path: "tab1", path: "home",
component: () => import("@/views/Tab1Page.vue"), component: () => import("@/views/home/index.vue"),
}, },
{ {
path: "tab2", path: "market",
component: () => import("@/views/Tab2Page.vue"), component: () => import("@/views/market/index.vue"),
}, },
{ {
path: "tab3", path: "user",
component: () => import("@/views/Tab3Page.vue"), component: () => import("@/views/user/index.vue"),
}, },
], ],
}, },

View File

@@ -1,25 +1,29 @@
<script setup lang="ts"> <script setup lang="ts">
import { IonContent, IonHeader, IonPage, IonTitle, IonToolbar } from "@ionic/vue"; import { IonButton, IonContent, IonHeader, IonPage, IonTitle, IonToolbar } from "@ionic/vue";
import { ref } from "vue";
import { authClient } from "@/auth";
import ExploreContainer from "@/components/ExploreContainer.vue"; import ExploreContainer from "@/components/ExploreContainer.vue";
const res = ref(null);
</script> </script>
<template> <template>
<IonPage> <IonPage>
<IonHeader> <IonHeader>
<IonToolbar> <IonToolbar>
<IonTitle>Tab 3</IonTitle> <IonTitle>Home</IonTitle>
</IonToolbar> </IonToolbar>
</IonHeader> </IonHeader>
<IonContent :fullscreen="true"> <IonContent :fullscreen="true">
<IonHeader collapse="condense"> <IonHeader collapse="condense">
<IonToolbar> <IonToolbar>
<IonTitle size="large"> <IonTitle size="large">
Tab 3 Home
</IonTitle> </IonTitle>
</IonToolbar> </IonToolbar>
</IonHeader> </IonHeader>
<ExploreContainer name="Tab 3 page" /> <ExploreContainer name="Home page" />
</IonContent> </IonContent>
</IonPage> </IonPage>
</template> </template>

View File

@@ -7,19 +7,19 @@ import ExploreContainer from "@/components/ExploreContainer.vue";
<IonPage> <IonPage>
<IonHeader> <IonHeader>
<IonToolbar> <IonToolbar>
<IonTitle>Tab 2</IonTitle> <IonTitle>Market</IonTitle>
</IonToolbar> </IonToolbar>
</IonHeader> </IonHeader>
<IonContent :fullscreen="true"> <IonContent :fullscreen="true">
<IonHeader collapse="condense"> <IonHeader collapse="condense">
<IonToolbar> <IonToolbar>
<IonTitle size="large"> <IonTitle size="large">
Tab 2 Market
</IonTitle> </IonTitle>
</IonToolbar> </IonToolbar>
</IonHeader> </IonHeader>
<ExploreContainer name="Tab 2 page" /> <ExploreContainer name="Market page" />
</IonContent> </IonContent>
</IonPage> </IonPage>
</template> </template>

View File

@@ -7,19 +7,19 @@ import ExploreContainer from "@/components/ExploreContainer.vue";
<IonPage> <IonPage>
<IonHeader> <IonHeader>
<IonToolbar> <IonToolbar>
<IonTitle>Tab 1</IonTitle> <IonTitle>User</IonTitle>
</IonToolbar> </IonToolbar>
</IonHeader> </IonHeader>
<IonContent :fullscreen="true"> <IonContent :fullscreen="true">
<IonHeader collapse="condense"> <IonHeader collapse="condense">
<IonToolbar> <IonToolbar>
<IonTitle size="large"> <IonTitle size="large">
Tab 1 User
</IonTitle> </IonTitle>
</IonToolbar> </IonToolbar>
</IonHeader> </IonHeader>
<ExploreContainer name="Tab 1 page" /> <ExploreContainer name="User page" />
</IonContent> </IonContent>
</IonPage> </IonPage>
</template> </template>