- 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 为空时直接显示空态,不再发起错误请求
28 lines
1.0 KiB
Plaintext
28 lines
1.0 KiB
Plaintext
<view class="page">
|
|
<navbar title="{{navTitle}}" show-back="{{selectMode}}" />
|
|
<view class="searchbar">
|
|
<view class="searchbar__box">
|
|
<text class="searchbar__icon">🔍</text>
|
|
<input
|
|
class="searchbar__input"
|
|
placeholder="{{selectMode ? '选择动作加入计划' : '搜索动作 / 器械 / 部位'}}"
|
|
placeholder-class="ph"
|
|
value="{{q}}"
|
|
confirm-type="search"
|
|
bindinput="onInput" />
|
|
</view>
|
|
</view>
|
|
<view wx:if="{{selectMode}}" class="hint">从下方结果中选择动作,加入当前计划</view>
|
|
|
|
<view class="section" style="padding-top: 8rpx;">
|
|
<view class="grid" wx:if="{{results.length}}">
|
|
<view class="grid__item" wx:for="{{results}}" wx:key="id">
|
|
<exercise-card exercise="{{item}}" catch:tap="onExercise" />
|
|
</view>
|
|
</view>
|
|
<view wx:elif="{{loading}}" class="empty">搜索中…</view>
|
|
<view wx:elif="{{searched}}" class="empty">未找到相关动作</view>
|
|
<view wx:else class="empty">输入关键词开始搜索</view>
|
|
</view>
|
|
</view>
|