feat: 根据路由 meta 决定是否显示 footer

This commit is contained in:
jxxghp
2025-03-09 21:43:52 +08:00
parent 9355788221
commit 25cf9d7fce
2 changed files with 12 additions and 9 deletions
+10 -9
View File
@@ -51,8 +51,8 @@ export default defineComponent({
const main = h( const main = h(
'main', 'main',
{ class: 'layout-page-content' }, { class: 'layout-page-content' },
h(Transition, { name: 'fade-slide', mode: 'out-in', appear: true }, h(Transition, { name: 'fade-slide', mode: 'out-in', appear: true }, () =>
() => h('section', { class: 'page-content-container' }, slots.default?.()), h('section', { class: 'page-content-container' }, slots.default?.()),
), ),
) )
@@ -69,6 +69,9 @@ export default defineComponent({
}, },
}) })
// 👉 修改:根据路由 meta 决定是否显示 footer
const shouldShowFooter = !route.meta.hideFooter
return h( return h(
'div', 'div',
{ {
@@ -82,7 +85,7 @@ export default defineComponent({
}, },
[ [
verticalNav, verticalNav,
h('div', { class: 'layout-content-wrapper' }, [navbar, main, footer]), h('div', { class: 'layout-content-wrapper' }, [navbar, main, shouldShowFooter && footer]),
layoutOverlay, layoutOverlay,
], ],
) )
@@ -92,9 +95,9 @@ export default defineComponent({
</script> </script>
<style lang="scss"> <style lang="scss">
@use "@configured-variables" as variables; @use '@configured-variables' as variables;
@use "@layouts/styles/placeholders"; @use '@layouts/styles/placeholders';
@use "@layouts/styles/mixins"; @use '@layouts/styles/mixins';
.layout-wrapper.layout-nav-type-vertical { .layout-wrapper.layout-nav-type-vertical {
// TODO(v2): Check why we need height in vertical nav & min-height in horizontal nav // TODO(v2): Check why we need height in vertical nav & min-height in horizontal nav
@@ -116,9 +119,7 @@ export default defineComponent({
inset-block-start: 0; inset-block-start: 0;
.navbar-content-container { .navbar-content-container {
block-size: calc( block-size: calc(env(safe-area-inset-top) + variables.$layout-vertical-nav-navbar-height);
env(safe-area-inset-top) + variables.$layout-vertical-nav-navbar-height
);
} }
@at-root { @at-root {
+2
View File
@@ -96,6 +96,7 @@ const router = createRouter({
component: () => import('../pages/history.vue'), component: () => import('../pages/history.vue'),
meta: { meta: {
requiresAuth: true, requiresAuth: true,
hideFooter: true,
}, },
}, },
{ {
@@ -178,6 +179,7 @@ const router = createRouter({
meta: { meta: {
keepAlive: true, keepAlive: true,
requiresAuth: true, requiresAuth: true,
hideFooter: true,
}, },
}, },
{ {