Skip to content

Commit

Permalink
renderer: Comment: wait 500ms after posting new comment
Browse files Browse the repository at this point in the history
  • Loading branch information
rocka committed Jan 27, 2022
1 parent 495d229 commit 750bd26
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/renderer/page/Comment/Comment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<keep-alive>
<CommentList :key="tab"
:thread="thread"
v-bind="comment[tab]"
v-bind.sync="comment[tab]"
@page="loadComments"
@reply="handleReply"></CommentList>
</keep-alive>
Expand Down Expand Up @@ -185,14 +185,15 @@ export default {
} else {
resp = await Api.addComment(this.thread, this.editorContent);
}
this.posting = false;
if (resp.code === 200) {
this.editorOpen = false;
this.tab = 'all';
await new Promise(_ => setTimeout(_, 500));
this.loadComments();
} else {
this.$toast.message(`发布评论失败 ... ${resp.code}: ${resp.msg}`);
}
this.posting = false;
}
},
watch: {
Expand Down
3 changes: 1 addition & 2 deletions src/renderer/page/Comment/CommentList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ export default {
const resp = await Api.deleteComment(this.thread, commentId);
if (resp.code === 200) {
this.$toast.message('删除评论成功');
const index = this.comments.findIndex(cmt => cmt.commentId === commentId);
this.comments.splice(index, 1);
this.$emit('update:comments', this.comments.filter(c => c.commentId !== commentId));
} else {
this.$toast.message(`删除评论失败 ... ${resp.code}: ${resp.msg}`);
}
Expand Down

0 comments on commit 750bd26

Please sign in to comment.