From ee646506a90a9cb8322b87c4ccc79e0c80228142 Mon Sep 17 00:00:00 2001 From: anghunk Date: Fri, 23 Jan 2026 19:52:08 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E7=BB=84=E4=BB=B6):=20=E4=B8=BA=E8=AF=84?= =?UTF-8?q?=E8=AE=BA=E9=A1=B9=E7=BB=84=E4=BB=B6=E6=B7=BB=E5=8A=A0=E7=82=B9?= =?UTF-8?q?=E8=B5=9E=E5=8A=9F=E8=83=BD=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 扩展评论项组件以支持点赞功能,包括传递点赞启用标志和点赞事件处理器。 同时更新评论列表组件,将点赞处理器参数扩展为包含评论ID和点赞状态。 --- docs/widget/src/components/CommentItem.js | 6 +++++- docs/widget/src/components/CommentList.js | 10 ++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/docs/widget/src/components/CommentItem.js b/docs/widget/src/components/CommentItem.js index cd194f5..e1f660a 100644 --- a/docs/widget/src/components/CommentItem.js +++ b/docs/widget/src/components/CommentItem.js @@ -231,7 +231,9 @@ export class CommentItem extends Component { submitting: this.props.submitting, adminEmail: this.props.adminEmail, adminBadge: this.props.adminBadge, + enableCommentLike: this.props.enableCommentLike, onReply: this.props.onReply, + onLikeComment: this.props.onLikeComment, onSubmitReply: this.props.onSubmitReply, onCancelReply: this.props.onCancelReply, onUpdateReplyContent: this.props.onUpdateReplyContent, @@ -304,7 +306,9 @@ export class CommentItem extends Component { replyingTo: this.props.replyingTo, replyContent: this.props.replyContent, replyError: this.props.replyError, - submitting: this.props.submitting + submitting: this.props.submitting, + enableCommentLike: this.props.enableCommentLike, + onLikeComment: this.props.onLikeComment }); }); } diff --git a/docs/widget/src/components/CommentList.js b/docs/widget/src/components/CommentList.js index e81351e..0a98ae8 100644 --- a/docs/widget/src/components/CommentList.js +++ b/docs/widget/src/components/CommentList.js @@ -103,7 +103,7 @@ export class CommentList extends Component { onCancelReply: () => this.handleCancelReply(), onUpdateReplyContent: (content) => this.handleUpdateReplyContent(content), onClearReplyError: () => this.handleClearReplyError(), - onLikeComment: (commentId) => this.handleLikeComment(commentId) + onLikeComment: (commentId, isLike) => this.handleLikeComment(commentId, isLike) }); commentItem.render(); // 缓存 CommentItem 实例 @@ -166,7 +166,9 @@ export class CommentList extends Component { replyingTo: this.props.replyingTo, replyContent: this.props.replyContent, replyError: this.props.replyError, - submitting: this.props.submitting + submitting: this.props.submitting, + enableCommentLike: this.props.enableCommentLike, + onLikeComment: (commentId, isLike) => this.handleLikeComment(commentId, isLike) }); }); return; @@ -222,9 +224,9 @@ export class CommentList extends Component { } } - handleLikeComment(commentId) { + handleLikeComment(commentId, isLike) { if (this.props.onLikeComment) { - this.props.onLikeComment(commentId); + this.props.onLikeComment(commentId, isLike); } }