Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/capsule-bar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Component({
value: false
},
// 禁用右侧按钮返回主页
// 现在禁用返回会直接隐藏该按钮
disableHome: {
type: Boolean,
value: false
Expand Down Expand Up @@ -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,
})
}
});
}
},

Expand All @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions src/capsule-bar/index.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
<cover-view
wx:if="{{!hiddenCapsule}}"
class="capsule-button"
style="border-color: rgba({{capsuleColor==='black'?'0,0,0,0.1':'255,255,255,0.25'}});background-color: rgba({{capsuleColor==='black'?'255,255,255,0.6':'0,0,0,0.15'}});width: {{capsuleButtonInfo.width}}px;height: {{capsuleButtonInfo.height}}px;left: {{capsuleButtonInfo.left}}px;top: {{capsuleButtonInfo.top}}px;"
style="{{disableHome?'border:none;':''}}border-color: rgba({{capsuleColor==='black'?'0,0,0,0.1':'255,255,255,0.25'}});background-color: rgba({{capsuleColor==='black'?(disableHome?'0,0,0,0':'255,255,255,0.6'):'0,0,0,0.15'}});width: {{capsuleButtonInfo.width}}px;height: {{capsuleButtonInfo.height}}px;left: {{capsuleButtonInfo.left}}px;top: {{capsuleButtonInfo.top}}px;"
>
<!--左侧按钮-->
<cover-view mut-bind:tap="onTapLeftButton"
catch:longpress="onLongPressLeftButton"
hover-class="icon-wrapper-hover-{{capsuleColor}}"
hover-class="icon-wrapper-hover-{{!disableHome?capsuleColor:''}}"
class="icon-wrapper"
style="width: {{capsuleButtonInfo.width/2}}px;height: {{capsuleButtonInfo.height}}px;">
<cover-image class="icon-left" src="icons/capsule-left-{{capsuleColor}}.png"></cover-image>
Expand All @@ -38,7 +38,7 @@
<cover-view class="line"></cover-view>

<!--右侧按钮-->
<cover-view mut-bind:tap="onTapRightButton"
<cover-view mut-bind:tap="onTapRightButton" wx:if="{{!disableHome}}"
catch:longpress="onLongPressRightButton"
hover-class="icon-wrapper-hover-{{capsuleColor}}"
class="icon-wrapper"
Expand Down