Skip to content

Commit 56c82ad

Browse files
committed
fix: 使用计算属性 nickname 替代直接访问 user_nickname
1 parent 01e94e4 commit 56c82ad

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/components/common/post-item.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<a
3030
:href="post.user_id ? author_url(post.user_id) : null"
3131
class="u-name"
32-
v-text="post.user_nickname"
32+
v-text="nickname"
3333
target="_blank"
3434
></a>
3535
</div>
@@ -65,6 +65,9 @@ export default {
6565
client() {
6666
return this.$store.state.client;
6767
},
68+
nickname() {
69+
return this.post?.user?.display_name || this.post?.user_nickname || "匿名";
70+
}
6871
},
6972
data() {
7073
return {

0 commit comments

Comments
 (0)