修复tabbar的问题

This commit is contained in:
Jason 2023-01-17 15:56:12 +08:00
parent 9595769d46
commit 20b7c760fd
1 changed files with 9 additions and 0 deletions

View File

@ -1,5 +1,6 @@
<template> <template>
<u-tabbar <u-tabbar
v-if="showTabbar"
v-model="current" v-model="current"
v-bind="tabbarStyle" v-bind="tabbarStyle"
:list="tabbarList" :list="tabbarList"
@ -27,6 +28,14 @@ const tabbarList = computed(() => {
}) })
}) })
const showTabbar = computed(() => {
const currentPages = getCurrentPages()
const currentPage = currentPages[currentPages.length - 1]
const current = tabbarList.value.findIndex((item: any) => {
return item.pagePath === '/' + currentPage.route
})
return current >= 0
})
const tabbarStyle = computed(() => ({ const tabbarStyle = computed(() => ({
activeColor: appStore.getStyleConfig.selectedColor, activeColor: appStore.getStyleConfig.selectedColor,
inactiveColor: appStore.getStyleConfig.defaultColor inactiveColor: appStore.getStyleConfig.defaultColor