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: {
oneCategoryHeight: function () {
this.$forceUpdate();
},
oneCategorySelect: function () {
this.scrollTop = -1;
this.goodsList = [];

View File

@@ -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;