From 9a6ea83db4244cddca33d0cc828c18aef1684f55 Mon Sep 17 00:00:00 2001 From: GrinZero <774933704@qq.com> Date: Sat, 4 Sep 2021 17:01:06 +0800 Subject: [PATCH] =?UTF-8?q?=E8=83=B6=E5=9B=8A=E6=A0=8F=E9=9A=90=E8=97=8F?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E4=B8=BB=E9=A1=B5=EF=BC=9B=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E4=B8=8A=E4=B8=80=E5=B1=82=E9=94=99=E8=AF=AF=E5=88=99=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E4=B8=BB=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/capsule-bar/index.js | 13 ++++++++++--- src/capsule-bar/index.wxml | 6 +++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/capsule-bar/index.js b/src/capsule-bar/index.js index 5d04af59..b11700f8 100644 --- a/src/capsule-bar/index.js +++ b/src/capsule-bar/index.js @@ -41,6 +41,7 @@ Component({ value: false }, // 禁用右侧按钮返回主页 + // 现在禁用返回会直接隐藏该按钮 disableHome: { type: Boolean, value: false @@ -107,9 +108,15 @@ Component({ */ onTapLeftButton() { eventUtil.emit(this, 'linlefttap'); - + const {homePage} = this.data; if (!this.data.disableBack) { - wx.navigateBack(); + wx.navigateBack({ + fail:()=>{ + wx.redirectTo({ + url: homePage, + }) + } + }); } }, @@ -126,7 +133,7 @@ Component({ async onTapRightButton() { eventUtil.emit(this, 'linrighttap'); - const homePage = this.data.homePage; + const {homePage} = this.data; if (!this.data.disableHome) { wx.switchTab({ url: homePage, diff --git a/src/capsule-bar/index.wxml b/src/capsule-bar/index.wxml index 7f688831..9caf4743 100644 --- a/src/capsule-bar/index.wxml +++ b/src/capsule-bar/index.wxml @@ -23,12 +23,12 @@ @@ -38,7 +38,7 @@ -