From a9d507a13f5eff939b9dfb2242a204d445460d42 Mon Sep 17 00:00:00 2001 From: xuxueyang <xuxy@fengyuntec.com> Date: 星期二, 06 八月 2024 18:26:25 +0800 Subject: [PATCH] update 跳转的逻辑栈 --- components/footer/customer-footer.vue | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletions(-) diff --git a/components/footer/customer-footer.vue b/components/footer/customer-footer.vue index 3cc049b..0627f98 100644 --- a/components/footer/customer-footer.vue +++ b/components/footer/customer-footer.vue @@ -93,12 +93,23 @@ } } + //判断,如果上上上级别,就是要跳转的,改为返回,避免堆栈太多 + const pages = getCurrentPages(); + //如果上一层就是购物车,那么就返回,而不是跳转 + // console.log('toShopping',pages) + if (pages && pages.length >= 2) { + if ( ('/' + pages[pages.length - 2].route) === item.pagePath) { + uni.navigateBack() + return + } + } + uni.navigateTo({ url: item.pagePath }) } else { - uni.redirectTo({ + uni.reLaunch({ url: item.pagePath }); -- Gitblit v1.9.3