chore:H5和微信小程序的返回第一个一级标题时右侧高度正确更新。

This commit is contained in:
2026-07-22 10:38:51 +08:00
parent d4a249d744
commit 25fc8311f8
2 changed files with 17 additions and 14 deletions

View File

@@ -646,6 +646,9 @@ export default {
} }
}, },
watch: { watch: {
oneCategoryHeight: function () {
this.$forceUpdate();
},
oneCategorySelect: function () { oneCategorySelect: function () {
this.scrollTop = -1; this.scrollTop = -1;
this.goodsList = []; this.goodsList = [];

View File

@@ -537,20 +537,20 @@ export default {
this.getOneCategoryItemHeight(index); this.getOneCategoryItemHeight(index);
}, },
getOneCategoryItemHeight(index) { getOneCategoryItemHeight(index) {
if (!query || typeof query.selectAll !== 'function') { setTimeout(() => {
query = uni.createSelectorQuery && uni.createSelectorQuery().in(this); const newQuery = uni.createSelectorQuery && uni.createSelectorQuery().in(this);
} if (!newQuery || typeof newQuery.selectAll !== 'function') {
if (!query || typeof query.selectAll !== 'function') { return;
return; }
} newQuery
query .selectAll('.category-item-wrap .category-item')
.selectAll('.category-item-wrap .category-item') .boundingClientRect(data => {
.boundingClientRect(data => { if (data && data.length > index && data[index].height) {
if (data && data.length > index && data[index].height) { this.oneCategoryItemHeight = data[index].height;
this.oneCategoryItemHeight = data[index].height; }
} })
}) .exec();
.exec(); }, 200);
}, },
saveSecondCategoryName(name) { saveSecondCategoryName(name) {
this.lastSecondCategoryName = name; this.lastSecondCategoryName = name;