谢谢 Moin,我 fork 了该主题并编辑了 javascripts/discourse/connectors/topic-list-item/item.gjs
希望这能帮助到别人。
- 我添加了这段代码
get likeCount() {
return (
this.args.outletArgs.topic.like_count ??
this.args.outletArgs.topic.likeCount ??
0
);
}
位于这段代码下方
@action
share(event) {
event.stopPropagation();
this.modal.show(ShareTopicModal, {
model: { topic: this.args.outletArgs.topic },
});
}
get likeCount() {
return (
this.args.outletArgs.topic.like_count ??
this.args.outletArgs.topic.likeCount ??
0
);
}
<template>
- 然后我将这段代码
<div class="custom-topic-layout_bottom-bar">
<span class="reply-count">
{{icon "reply"}}
{{@outletArgs.topic.replyCount}}
{{i18n "replies"}}
</span>
修改为:
<div class="custom-topic-layout_bottom-bar">
<span class="like-count">
{{icon "heart"}}
{{this.likeCount}}
点赞
</span>
<span class="reply-count">
{{icon "reply"}}
{{@outletArgs.topic.replyCount}}
{{i18n "replies"}}
</span>```