From 6d701c5204e34f923a2f418a0041994b318630c5 Mon Sep 17 00:00:00 2001 From: xieyonghong <18010623010@163.com> Date: Mon, 30 Jan 2023 16:52:33 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0PageContainer?= =?UTF-8?q?=EF=BC=9B=E5=AE=8C=E5=96=84=E5=8A=A8=E6=80=81=E8=B7=AF=E7=94=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Layout/BasicLayoutPage.vue | 24 ++ .../components/PageContainer/index.less | 23 ++ .../Layout/components/PageContainer/index.tsx | 248 ++++++++++++++++++ .../components/PageContainer/types.d.ts | 56 ++++ src/components/Layout/index.ts | 3 +- src/components/index.ts | 3 +- src/store/menu.ts | 14 +- src/views/system/Basis/index.vue | 3 + vite.config.ts | 1 + 9 files changed, 366 insertions(+), 9 deletions(-) create mode 100644 src/components/Layout/components/PageContainer/index.less create mode 100644 src/components/Layout/components/PageContainer/types.d.ts diff --git a/src/components/Layout/BasicLayoutPage.vue b/src/components/Layout/BasicLayoutPage.vue index eea76ad6..054f54ad 100644 --- a/src/components/Layout/BasicLayoutPage.vue +++ b/src/components/Layout/BasicLayoutPage.vue @@ -5,7 +5,12 @@ v-model:collapsed="state.collapsed" v-model:selectedKeys="state.selectedKeys" :pure='state.pure' + :breadcrumb='{ routes: breadcrumb }' > + @@ -25,6 +30,7 @@ type StateType = { } const router = useRouter() +const route = useRoute() const menu = useMenuStore() @@ -43,6 +49,16 @@ const state = reactive({ selectedKeys: [], }); +const breadcrumb = computed(() => + router.currentRoute.value.matched.concat().map((item, index) => { + return { + index, + path: item.path, + breadcrumbName: item.meta.title || '' + } + }) +) + watchEffect(() => { if (router.currentRoute) { const matched = router.currentRoute.value.matched.concat() @@ -53,6 +69,14 @@ watchEffect(() => { // TODO 获取当前路由中参数,用于控制pure }) +watchEffect(() => { + if (route.query && 'layout' in route.query && route.query.layout === 'false') { + state.pure = true + } else { + state.pure = false + } +}) +