xugenyuan

ref |> 解决评论列表翻页新问题

@@ -260,7 +260,6 @@ export struct CommentComponent { @@ -260,7 +260,6 @@ export struct CommentComponent {
260 this.publishCommentModel.targetType) 260 this.publishCommentModel.targetType)
261 .then(commentListModel => { 261 .then(commentListModel => {
262 console.log('评论:', JSON.stringify(commentListModel.list)) 262 console.log('评论:', JSON.stringify(commentListModel.list))
263 - this.currentPage++  
264 263
265 if (Number.parseInt(commentListModel.totalCommentNum) > 264 if (Number.parseInt(commentListModel.totalCommentNum) >
266 Number.parseInt(this.publishCommentModel.totalCommentNumer)) { 265 Number.parseInt(this.publishCommentModel.totalCommentNumer)) {
@@ -279,7 +278,9 @@ export struct CommentComponent { @@ -279,7 +278,9 @@ export struct CommentComponent {
279 278
280 if (commentListModel && commentListModel.list && commentListModel.list.length > 0) { 279 if (commentListModel && commentListModel.list && commentListModel.list.length > 0) {
281 280
  281 + if (this.currentPage == 1) {
282 this.allDatas.clearAllData() // 防止数据重复问题 282 this.allDatas.clearAllData() // 防止数据重复问题
  283 + }
283 commentListModel.list.forEach(element => { 284 commentListModel.list.forEach(element => {
284 element.hasMore = Number.parseInt(element.childCommentNum) ? true : false 285 element.hasMore = Number.parseInt(element.childCommentNum) ? true : false
285 let newModel = commentViewModel.deepCopyCommentItemModel(element) 286 let newModel = commentViewModel.deepCopyCommentItemModel(element)
@@ -293,6 +294,8 @@ export struct CommentComponent { @@ -293,6 +294,8 @@ export struct CommentComponent {
293 } else { 294 } else {
294 this.hasMore = false 295 this.hasMore = false
295 } 296 }
  297 +
  298 + this.currentPage++
296 if (!this.fixedHeightMode && this.reachEndLoadMoreFinish) { 299 if (!this.fixedHeightMode && this.reachEndLoadMoreFinish) {
297 this.reachEndLoadMoreFinish() 300 this.reachEndLoadMoreFinish()
298 } 301 }