From fbc074229fd4736f1ae2793c9daebf04726188b2 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期五, 22 五月 2026 18:27:27 +0800
Subject: [PATCH] 提交
---
small-program/components/custom-tabbar/custom-tabbar.vue | 25 +++++++++++++++++++++----
1 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/small-program/components/custom-tabbar/custom-tabbar.vue b/small-program/components/custom-tabbar/custom-tabbar.vue
index 7f214a3..720b4e1 100644
--- a/small-program/components/custom-tabbar/custom-tabbar.vue
+++ b/small-program/components/custom-tabbar/custom-tabbar.vue
@@ -19,6 +19,7 @@
return {
safeAreaBottom: 0,
showLogin: false,
+ currentPath: '',
memberTabList: [
{
text: '棣栭〉',
@@ -76,11 +77,8 @@
computed: {
...mapState(['userType', 'token']),
currentIndex() {
- const pages = getCurrentPages()
- const currentPage = pages[pages.length - 1]
- const currentPath = '/' + currentPage.route
const list = this.tabList
- const index = list.findIndex(item => item.pagePath === currentPath)
+ const index = list.findIndex(item => item.pagePath === this.currentPath)
return index > -1 ? index : 0
},
tabList() {
@@ -92,12 +90,31 @@
},
created() {
this.getSafeAreaBottom()
+ this.updateCurrentPath()
+ },
+ onShow() {
+ this.updateCurrentPath()
+ },
+ watch: {
+ userType() {
+ this.$forceUpdate()
+ }
+ },
+ activated() {
+ this.$forceUpdate()
},
methods: {
getSafeAreaBottom() {
const systemInfo = uni.getSystemInfoSync()
this.safeAreaBottom = systemInfo.safeAreaInsets.bottom || 0
},
+ updateCurrentPath() {
+ const pages = getCurrentPages()
+ if (pages.length > 0) {
+ const currentPage = pages[pages.length - 1]
+ this.currentPath = '/' + currentPage.route
+ }
+ },
switchTab(item) {
if (item.pagePath === '/pages/itinerary/itinerary' && !this.token) {
this.showLogin = true
--
Gitblit v1.9.3