Skip to content

Commit

Permalink
feat: 空示例模块
Browse files Browse the repository at this point in the history
  • Loading branch information
pany-ang committed Feb 22, 2025
1 parent 864be5f commit c4e47fc
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 7 deletions.
13 changes: 13 additions & 0 deletions src/pages/home/components/Title.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<script setup lang="ts">
interface Props {
text: string
}
const props = defineProps<Props>()
</script>

<template>
<span un-pl-16px un-color-hex-969799 un-text-14px un-fw400>
{{ props.text }}
</span>
</template>
19 changes: 14 additions & 5 deletions src/pages/home/index.vue
Original file line number Diff line number Diff line change
@@ -1,24 +1,33 @@
<script setup lang="ts">
import { demoRoutes, systemRoutes } from "@/router"
import { demoRoutes, emptyDemoRoutes, systemRoutes } from "@/router"
import Description from "@@/components/Description.vue"
import Cell from "./components/Cell.vue"
import Title from "./components/Title.vue"
</script>

<template>
<div un-px-20px un-py-26px un-select-none>
<Description un-pl-16px />
<div un-mt-40px>
<span un-pl-16px un-color-hex-969799 un-text-14px un-fw400>
示例集合
</span>
<Title text="示例集合" />
<Cell
v-for="route in [...demoRoutes, ...systemRoutes]"
:key="route.path"
:title="route.meta?.title || ''"
:path="route.path"
un-mt-12px
/>
<van-divider>🔥 更多优秀示例,期待你的 PR 👏🏻</van-divider>
</div>
<div un-my-20px>
<Title text="空示例集合" />
<Cell
v-for="route in emptyDemoRoutes"
:key="route.path"
:title="route.meta?.title || ''"
:path="route.path"
un-mt-12px
/>
</div>
<van-divider>🔥 更多优秀示例,期待你的 PR 👏🏻</van-divider>
</div>
</template>
7 changes: 5 additions & 2 deletions src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,10 @@ export const demoRoutes: RouteRecordRaw[] = [
}
}
}
},
}
]

export const emptyDemoRoutes: RouteRecordRaw[] = [
{
path: "/i18n",
component: () => import("@/pages/demo/i18n.vue"),
Expand All @@ -160,7 +163,7 @@ export const demoRoutes: RouteRecordRaw[] = [
/** 路由实例 */
export const router = createRouter({
history: VITE_ROUTER_HISTORY === "hash" ? createWebHashHistory(VITE_PUBLIC_PATH) : createWebHistory(VITE_PUBLIC_PATH),
routes: [...systemRoutes, ...routes, ...demoRoutes]
routes: [...systemRoutes, ...routes, ...demoRoutes, ...emptyDemoRoutes]
})

// 注册路由导航守卫
Expand Down

0 comments on commit c4e47fc

Please sign in to comment.