fix: add css var safe padding bottom

This commit is contained in:
YunYouJun
2023-11-06 02:00:56 +08:00
parent 85c8f4fcd1
commit d3ab8fb2c1
4 changed files with 13 additions and 10 deletions

View File

@@ -38,24 +38,21 @@ const route = useRoute()
const router = useRouter() const router = useRouter()
function onClick(item: BottomMenuItem) { function onClick(item: BottomMenuItem) {
router.push(item.to || '/') // router.push(item.to || '/')
router.replace(item.to || '/')
} }
</script> </script>
<template> <template>
<YlfBottomMenu shadow-2xl> <YlfBottomMenu shadow-2xl pb="$cook-bottom-menu-padding-bottom">
<YlfBottomMenuItem <YlfBottomMenuItem
v-for="item in items" v-for="item in items"
:key="item.to" :key="item.to"
:item="item" :item="item"
:active="route.path === item.to" :active="route.path === item.to"
@click="onClick" @click="onClick"
class="pt-3"
style="backdrop-filter: blur(10px);"
/> />
</YlfBottomMenu> </YlfBottomMenu>
</template> </template>
<style>
.ylf-bottom-menu {
padding-bottom: env(safe-area-inset-bottom);
}
</style>

View File

@@ -1,5 +1,5 @@
<template> <template>
<main class="text-center text-gray-700 dark:text-gray-200" p="t-8 b-15"> <main class="cook-main text-center text-gray-700 dark:text-gray-200" p="t-8 b-$cook-bottom-menu-height">
<slot /> <slot />
<DarkToggle absolute right-3 top-5 /> <DarkToggle absolute right-3 top-5 />
<TheBottomMenu fixed bottom-0 left-0 right-0 /> <TheBottomMenu fixed bottom-0 left-0 right-0 />

View File

@@ -1,6 +1,6 @@
{ {
"type": "module", "type": "module",
"version": "1.1.6", "version": "1.1.7",
"private": true, "private": true,
"packageManager": "pnpm@8.10.2", "packageManager": "pnpm@8.10.2",
"engines": { "engines": {

View File

@@ -22,3 +22,9 @@
.dark { .dark {
--ylf-c-border: #666; --ylf-c-border: #666;
} }
// cook custom
:root {
--cook-bottom-menu-padding-bottom: 20px;
--cook-bottom-menu-height: calc(64px + var(--cook-bottom-menu-padding-bottom));
}