fix(wish-tree): 修复切换树时导航栏消失问题
Publish Mini Program Dev Version / publish (push) Failing after 10m47s
Build and Deploy Server / build (push) Failing after 2s

- Canvas添加z-index: 1,确保不覆盖导航栏
- top-bar添加pointer-events: none,子元素恢复auto
- WXML添加trees.length保护,防止空数组访问
- switchTree添加空数组保护
This commit is contained in:
gouki
2026-08-07 21:56:38 +00:00
parent a2d4085bf4
commit b5bdf4c88d
8 changed files with 495 additions and 8 deletions
+2
View File
@@ -939,6 +939,8 @@ Page({
const direction = e.currentTarget.dataset.direction;
const { trees, currentTreeIndex } = this.data;
if (!trees.length) return;
let newIndex = currentTreeIndex;
if (direction === 'prev') {
newIndex = (currentTreeIndex - 1 + trees.length) % trees.length;
+1 -1
View File
@@ -13,7 +13,7 @@
<view class="switch-btn" bindtap="switchTree" data-direction="prev">
<text class="switch-icon"></text>
</view>
<view class="tree-name">{{trees[currentTreeIndex].name || '许愿树'}}</view>
<view class="tree-name">{{trees.length > 0 ? trees[currentTreeIndex].name : '许愿树'}}</view>
<view class="switch-btn" bindtap="switchTree" data-direction="next">
<text class="switch-icon"></text>
</view>
+6
View File
@@ -13,6 +13,7 @@
left: 0;
width: 100%;
height: 100%;
z-index: 1;
}
/* 顶部导航 */
@@ -26,6 +27,11 @@
justify-content: space-between;
align-items: center;
z-index: 100;
pointer-events: none;
}
.top-bar > * {
pointer-events: auto;
}
.tree-switcher {