...
|
...
|
@@ -6,7 +6,7 @@ |
|
|
<Loading></Loading>
|
|
|
</div>
|
|
|
<Scroll v-else ref="scroll" :data="commentList" :scroll-events="['scroll', 'scroll-end']" :options="scrollOption" @scroll="onScrollHandle" @scroll-end="onScrollEndHandle" @pulling-up="onPullingUp">
|
|
|
<div class="comment-list">
|
|
|
<div ref="commentList" class="comment-list">
|
|
|
<div ref="commentListTop" class="comment-list-top">
|
|
|
<div ref="commentPre" class="comment-pre-list">
|
|
|
<div
|
...
|
...
|
@@ -29,6 +29,7 @@ |
|
|
<CommentItem
|
|
|
v-for="comment in commentList"
|
|
|
:key="comment.parentComment.id"
|
|
|
:class="'comment-' + comment.parentComment.id"
|
|
|
:parent-comment="comment.parentComment"
|
|
|
:children-comments="comment.childrenComments"
|
|
|
:column-type="columnType"
|
...
|
...
|
@@ -165,6 +166,18 @@ export default { |
|
|
} else {
|
|
|
if (this.page <= 2) {
|
|
|
this.commentList = comments;
|
|
|
|
|
|
// 将评论滚动到可视区域
|
|
|
if (this.commentId) {
|
|
|
setTimeout(() => {
|
|
|
let scrollHeight = this.$refs.scroll.$el.offsetHeight;
|
|
|
let dom = this.$refs.commentList.getElementsByClassName('comment-' + this.commentId);
|
|
|
|
|
|
if (scrollHeight && dom.length && (dom[0].offsetHeight + dom[0].offsetoffsetTop > scrollHeight)) {
|
|
|
this.$refs.scroll.scrollTo(0, scrollHeight - this.$refs.commentList.offsetoffsetTop);
|
|
|
}
|
|
|
}, 500);
|
|
|
}
|
|
|
} else {
|
|
|
this.commentList = this.commentList.concat(comments);
|
|
|
}
|
...
|
...
|
|