diff --git a/pkg/views/src/components/posts/PostItem.vue b/pkg/views/src/components/posts/PostItem.vue index 66d37cc..a1fd23d 100644 --- a/pkg/views/src/components/posts/PostItem.vue +++ b/pkg/views/src/components/posts/PostItem.vue @@ -14,9 +14,19 @@
{{ props.item?.author.nick }}
-
Published an article
+
Published an + article +
+ +
@@ -27,13 +37,25 @@ import type { Component } from "vue"; import ArticleContent from "@/components/posts/ArticleContent.vue"; import MomentContent from "@/components/posts/MomentContent.vue"; +import PostReaction from "@/components/posts/PostReaction.vue"; const props = defineProps<{ item: any, brief?: boolean, loading?: boolean }>(); +const emits = defineEmits(["update:item"]); const renderer: { [id: string]: Component } = { article: ArticleContent, moment: MomentContent }; + +function updateReactions(symbol: string, num: number) { + const item = JSON.parse(JSON.stringify(props.item)); + if (item.reaction_list.hasOwnProperty(symbol)) { + item.reaction_list[symbol] += num; + } else { + item.reaction_list[symbol] = num; + } + emits("update:item", item); +}