diff --git a/pages_promotion/merch/detail.vue b/pages_promotion/merch/detail.vue index 54dd0c9..122774c 100644 --- a/pages_promotion/merch/detail.vue +++ b/pages_promotion/merch/detail.vue @@ -322,23 +322,27 @@ export default { return { headerHeight: 320, screenWidth: uni.getSystemInfoSync().windowWidth, - headerHeightInited: false, changeStyleDebounce: null }; }, mixins: [list], - watch: { - 'merch.desc': { - handler() { - if (!this.headerHeightInited) { - this.$nextTick(() => { - this.initHeaderHeight(); - }); - } - } - } - }, methods: { + getMerch() { + this.$api.sendRequest({ + url: '/merch/api/merch/merchinfo', + data: { + merch_id: this.merch_id + }, + success: res => { + if (res.code >= 0 && res.data) { + this.merch = res.data; + this.$nextTick(() => { + this.initHeaderHeight(); + }); + } + } + }); + }, showFullDesc() { if (this.merch.desc) { uni.showModal({ @@ -349,15 +353,12 @@ export default { } }, initHeaderHeight() { - setTimeout(() => { - const query = uni.createSelectorQuery().in(this); - query.select('.head-wrap').boundingClientRect(rect => { - if (rect && rect.height > 0) { - this.headerHeight = (rect.height / this.screenWidth) * 750; - this.headerHeightInited = true; - } - }).exec(); - }, 100); + const query = uni.createSelectorQuery().in(this); + query.select('.head-wrap').boundingClientRect(rect => { + if (rect && rect.height > 0) { + this.headerHeight = (rect.height / this.screenWidth) * 750; + } + }).exec(); }, changeListStyle() { if (this.changeStyleDebounce) clearTimeout(this.changeStyleDebounce); @@ -377,8 +378,8 @@ export default { @import './public/css/list.scss';