调试
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<van-config-provider :theme="theme" style="height: 100vh;">
|
||||
<van-config-provider :theme="theme" :style="{ height: vh }">
|
||||
<RouterView />
|
||||
<van-tabbar v-model="active" v-show="showTabbar">
|
||||
<van-tabbar-item icon="notes-o" to="/calendar">
|
||||
@@ -22,11 +22,30 @@
|
||||
import { RouterView, useRoute } from 'vue-router'
|
||||
import { ref, onMounted, onUnmounted, computed } from 'vue'
|
||||
|
||||
const vh = ref('100vh')
|
||||
|
||||
const setVh = () => {
|
||||
// 实际可视高度,能更好适配 iOS、PWA 等场景
|
||||
vh.value = window.innerHeight + 'px'
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
setVh()
|
||||
window.addEventListener('resize', setVh)
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
window.removeEventListener('resize', setVh)
|
||||
})
|
||||
|
||||
const route = useRoute()
|
||||
|
||||
// 根据路由判断是否显示Tabbar
|
||||
const showTabbar = computed(() => {
|
||||
return route.path !== '/login'
|
||||
return route.path === '/' ||
|
||||
route.path === '/calendar' ||
|
||||
route.path === '/email' ||
|
||||
route.path === '/setting'
|
||||
})
|
||||
|
||||
const active = ref(0)
|
||||
|
||||
Reference in New Issue
Block a user