fix(widget): 修复评论列表下一页、上一页超过第二页时的失效问题
- 修改 onPrevPage 函数以获取当前状态而不是依赖闭包变量 - 修改 onNextPage 函数以获取当前状态而不是依赖闭包变量 - 添加显式的状态获取逻辑确保分页操作基于最新状态 - 提高代码可读性和状态管理的准确性
This commit is contained in:
@@ -466,8 +466,14 @@ export class CWDComments {
|
||||
onUpdateReplyContent: (content) => this.store.updateReplyContent(content),
|
||||
onClearReplyError: () => this.store.clearReplyError(),
|
||||
replyPlaceholder: this.config.commentPlaceholder,
|
||||
onPrevPage: () => this.store.goToPage(state.pagination.page - 1),
|
||||
onNextPage: () => this.store.goToPage(state.pagination.page + 1),
|
||||
onPrevPage: () => {
|
||||
const currentState = this.store.store.getState();
|
||||
this.store.goToPage(currentState.pagination.page - 1);
|
||||
},
|
||||
onNextPage: () => {
|
||||
const currentState = this.store.store.getState();
|
||||
this.store.goToPage(currentState.pagination.page + 1);
|
||||
},
|
||||
onGoToPage: (page) => this.store.goToPage(page),
|
||||
onLikeComment: (commentId, isLike) => {
|
||||
if (this.store && typeof this.store.likeComment === 'function') {
|
||||
|
||||
Reference in New Issue
Block a user