- 8 个页面 exercise-card 由 bind:tap 改为 catch:tap,拦截原生 tap 冒泡 避免一次点击被『自定义事件 + 原生冒泡』触发两次, 第二次 e.detail 无 id → navigateTo detail?id=undefined → 404 - 所有 onExercise 顶部加 id 守卫,无 id 直接 return - exercise-card 点击前校验 exercise.id,缺失不触发 - detail onLoad 的 id 为空时直接显示空态,不再发起错误请求
30 lines
965 B
Plaintext
30 lines
965 B
Plaintext
<view class="page">
|
|
<navbar title="{{title}}" show-back />
|
|
|
|
<view class="section" style="padding-top: 8rpx;">
|
|
<scroll-view wx:if="{{values.length}}" scroll-x class="filterbar">
|
|
<chip
|
|
wx:for="{{values}}"
|
|
wx:key="value"
|
|
label="{{item.label}}"
|
|
value="{{item.value}}"
|
|
active="{{activeValue === item.value}}"
|
|
bind:tap="onValue" />
|
|
<view class="filterbar__spacer"></view>
|
|
</scroll-view>
|
|
|
|
<view class="count muted" wx:if="{{!loading}}">共 {{total}} 个动作</view>
|
|
|
|
<view class="grid" wx:if="{{exercises.length}}">
|
|
<view class="grid__item" wx:for="{{exercises}}" wx:key="id">
|
|
<exercise-card exercise="{{item}}" catch:tap="onExercise" />
|
|
</view>
|
|
</view>
|
|
<view wx:elif="{{!loading}}" class="empty">暂无数据</view>
|
|
<view wx:else class="empty">加载中…</view>
|
|
</view>
|
|
|
|
<view style="height: 160rpx;"></view>
|
|
<bottom-nav active="category" />
|
|
</view>
|