Authored by yyq

fix comment

@@ -124,6 +124,8 @@ export default { @@ -124,6 +124,8 @@ export default {
124 if (params.rootCommentId) { 124 if (params.rootCommentId) {
125 this.page = get(result, 'data.page', 1); 125 this.page = get(result, 'data.page', 1);
126 this.prePage = this.page - 1; 126 this.prePage = this.page - 1;
  127 + } else {
  128 + this.prePage = 0;
127 } 129 }
128 130
129 this.totalPage = get(result, 'data.totalPage', 1); 131 this.totalPage = get(result, 'data.totalPage', 1);
@@ -173,8 +175,9 @@ export default { @@ -173,8 +175,9 @@ export default {
173 let scrollHeight = this.$refs.scroll.$el.offsetHeight; 175 let scrollHeight = this.$refs.scroll.$el.offsetHeight;
174 let dom = this.$refs.commentList.getElementsByClassName('comment-' + this.commentId); 176 let dom = this.$refs.commentList.getElementsByClassName('comment-' + this.commentId);
175 177
176 - if (scrollHeight && dom.length && (dom[0].offsetHeight + dom[0].offsetoffsetTop > scrollHeight)) {  
177 - this.$refs.scroll.scrollTo(0, scrollHeight - this.$refs.commentList.offsetoffsetTop); 178 + if (scrollHeight && dom.length && (dom[0].offsetHeight + dom[0].offsetTop > scrollHeight)) {
  179 + console.log(scrollHeight - this.$refs.commentList.offsetHeight)
  180 + this.$refs.scroll.scrollTo(0, scrollHeight - this.$refs.commentList.offsetHeight);
178 } 181 }
179 }, 500); 182 }, 500);
180 } 183 }
@@ -209,7 +212,7 @@ export default { @@ -209,7 +212,7 @@ export default {
209 onScrollEndHandle(e) { 212 onScrollEndHandle(e) {
210 this.scrollY = e.y; 213 this.scrollY = e.y;
211 214
212 - if (this.prePage < 1) { 215 + if (!this.commentId || this.prePage < 1) {
213 return; 216 return;
214 } 217 }
215 218