From 700ee30bfb0e4dbc815cf36d79203e8856ab2561 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?TOP=E7=B3=AF=E7=B1=B3?= <1130395124@qq.com> Date: Mon, 3 Apr 2023 10:57:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=A1=B5=E9=9D=A2=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/layout/layout.vue | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/components/layout/layout.vue b/src/components/layout/layout.vue index 2cf46af..75bb09b 100644 --- a/src/components/layout/layout.vue +++ b/src/components/layout/layout.vue @@ -44,6 +44,7 @@ export default { headerHeight: 0, statusBarHeight: 0, bodyPaddingTop: 0, + backType: "back", }; }, components: { @@ -106,6 +107,10 @@ export default { if (this.showHeader) { this.bodyPaddingTop = safePaddingTop; } + const pages = getCurrentPages(); + if (pages.length < 2) { + this.backType = "home"; + } }, mounted() {}, methods: { @@ -113,7 +118,13 @@ export default { if (this.customBtn) { this.$emit("onClickBtn"); } else { - uni.navigateBack({ delta: 1 }); + if (this.backType == "home") { + uni.switchTab({ + url: "/pages/index/index", + }); + } else { + uni.navigateBack({ delta: 1 }); + } } }, // changeCity() {