diff --git a/pages_promotion/merch/detail.vue b/pages_promotion/merch/detail.vue index ecdb08a..b226aa5 100644 --- a/pages_promotion/merch/detail.vue +++ b/pages_promotion/merch/detail.vue @@ -24,12 +24,12 @@ - - {{ merch.desc }} + + {{ merch.desc }} ↓ 上滑查看更多 - + {{ isDescExpanded ? '↑ 收起' : '↓ 展开' }} @@ -336,7 +336,8 @@ export default { changeStyleDebounce: null, headerHeightInited: false, isDescExpanded: false, - isShowScrollHint: false + isShowScrollHint: false, + descKey: 0 }; }, mixins: [list], @@ -360,22 +361,22 @@ export default { }); }, toggleDesc() { - if (this.merch.desc) { - this.isDescExpanded = !this.isDescExpanded; - } - }, - handleDescClick() { if (!this.merch.desc) return; - this.isDescExpanded = !this.isDescExpanded; - }, - toggleDesc() { - if (!this.merch.desc) return; - this.isDescExpanded = !this.isDescExpanded; - if (this.isDescExpanded && this.merch.desc.length > 200) { - this.isShowScrollHint = true; - setTimeout(() => { - this.isShowScrollHint = false; - }, 3000); + + if (this.isDescExpanded) { + // 收起时切换 key 强制重新渲染,重置滚动位置 + this.descKey = this.descKey === 0 ? 1 : 0; + this.isDescExpanded = false; + this.isShowScrollHint = false; + } else { + // 展开时直接设置展开状态 + this.isDescExpanded = true; + if (this.merch.desc.length > 200) { + this.isShowScrollHint = true; + setTimeout(() => { + this.isShowScrollHint = false; + }, 3000); + } } }, initHeaderHeight() {