From 25fc8311f88332b360010dad0ce4309ec57ac5fe Mon Sep 17 00:00:00 2001 From: jinhhanhan <1683105490@qq.com> Date: Wed, 22 Jul 2026 10:38:51 +0800 Subject: [PATCH] =?UTF-8?q?chore=EF=BC=9AH5=E5=92=8C=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E7=9A=84=E8=BF=94=E5=9B=9E=E7=AC=AC?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=E4=B8=80=E7=BA=A7=E6=A0=87=E9=A2=98=E6=97=B6?= =?UTF-8?q?=E5=8F=B3=E4=BE=A7=E9=AB=98=E5=BA=A6=E6=AD=A3=E7=A1=AE=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components-diy/diy-category-item.vue | 3 +++ components-diy/diy-category.vue | 28 ++++++++++++++-------------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/components-diy/diy-category-item.vue b/components-diy/diy-category-item.vue index edad688..ba37b3b 100644 --- a/components-diy/diy-category-item.vue +++ b/components-diy/diy-category-item.vue @@ -646,6 +646,9 @@ export default { } }, watch: { + oneCategoryHeight: function () { + this.$forceUpdate(); + }, oneCategorySelect: function () { this.scrollTop = -1; this.goodsList = []; diff --git a/components-diy/diy-category.vue b/components-diy/diy-category.vue index 4de861a..51aa627 100644 --- a/components-diy/diy-category.vue +++ b/components-diy/diy-category.vue @@ -537,20 +537,20 @@ export default { this.getOneCategoryItemHeight(index); }, getOneCategoryItemHeight(index) { - if (!query || typeof query.selectAll !== 'function') { - query = uni.createSelectorQuery && uni.createSelectorQuery().in(this); - } - if (!query || typeof query.selectAll !== 'function') { - return; - } - query - .selectAll('.category-item-wrap .category-item') - .boundingClientRect(data => { - if (data && data.length > index && data[index].height) { - this.oneCategoryItemHeight = data[index].height; - } - }) - .exec(); + setTimeout(() => { + const newQuery = uni.createSelectorQuery && uni.createSelectorQuery().in(this); + if (!newQuery || typeof newQuery.selectAll !== 'function') { + return; + } + newQuery + .selectAll('.category-item-wrap .category-item') + .boundingClientRect(data => { + if (data && data.length > index && data[index].height) { + this.oneCategoryItemHeight = data[index].height; + } + }) + .exec(); + }, 200); }, saveSecondCategoryName(name) { this.lastSecondCategoryName = name;