Component({ properties: { exercise: { type: Object, value: {} }, score: { type: Number, value: 0 }, reason: { type: String, value: '' }, compact: { type: Boolean, value: false } }, data: { imgSrc: '', imgError: false }, observers: { // 卡片用轻量静态图(~6KB),避免 91KB 的 GIF 拖慢列表 exercise(ex) { this.setData({ imgSrc: (ex && ex.image) || '', imgError: false }); } }, methods: { onImgError() { this.setData({ imgError: true }); }, onTap() { const ex = this.data.exercise || {}; // 防御:id 缺失时绝不跳转(避免 navigate 到 /api/exercises/undefined 触发 404) if (!ex || !ex.id) return; this.triggerEvent('tap', { id: ex.id, exercise: ex }); } } });