diff --git a/components/mescroll/mescroll-uni.vue b/components/mescroll/mescroll-uni.vue index 3f896ce..7c15c48 100644 --- a/components/mescroll/mescroll-uni.vue +++ b/components/mescroll/mescroll-uni.vue @@ -217,6 +217,9 @@ } }, methods: { + scrollTo(y, t) { + this.mescroll.scrollTo(y, t); + }, //number,rpx,upx,px,% --> px的数值 toPx(num) { if (typeof num === 'string') { diff --git a/pages_goods/public/js/list.js b/pages_goods/public/js/list.js index 25925fb..29ac207 100644 --- a/pages_goods/public/js/list.js +++ b/pages_goods/public/js/list.js @@ -259,6 +259,18 @@ export default { this.goodsList = this.goodsList.concat(newArr); //追加新数据 if (this.$refs.loadingCover) this.$refs.loadingCover.hide(); + // #ifdef MP-HARMONY + // 鸿蒙下 mescroll 初始化时 setClientHeight 在 slot 内容渲染前执行,测得高度为 0 + // 数据加载后 scrollTo(0,0) 强制 mescroll 重新测量内容高度并重置滚动位置 + setTimeout(() => { + if (this.$refs.mescroll && this.$refs.mescroll.scrollTo) { + this.$refs.mescroll.scrollTo(0, 0); + } else if (this.$refs.mescroll && this.$refs.mescroll.mescroll) { + this.$refs.mescroll.mescroll.scrollTo(0, 0); + } + }, 100); + // #endif + this.waterfallflow((mescroll.num - 1) * 10); }, fail: res => {