From 5d6e23d932f9df49b8714e504a2e0d71535e495a Mon Sep 17 00:00:00 2001 From: ronger Date: Thu, 5 Jan 2023 15:07:51 +0800 Subject: [PATCH] fix(components): userAccount is not defined --- pages/article/_article_id.vue | 4 ++-- pages/portfolio/_portfolio_id.vue | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pages/article/_article_id.vue b/pages/article/_article_id.vue index b5f2aae..c92d0af 100644 --- a/pages/article/_article_id.vue +++ b/pages/article/_article_id.vue @@ -20,7 +20,7 @@
- + {{ article.articleAuthorName }} {{ article.timeAgo }} @@ -199,7 +199,7 @@ export default { hasPermissions() { let account = this.$store.state.auth.user?.nickname; if (account) { - if (account === this.article.articleAuthor.userNickname) { + if (account === this.article.articleAuthor?.userNickname) { return true; } } diff --git a/pages/portfolio/_portfolio_id.vue b/pages/portfolio/_portfolio_id.vue index 809edcf..c506bbd 100644 --- a/pages/portfolio/_portfolio_id.vue +++ b/pages/portfolio/_portfolio_id.vue @@ -23,7 +23,7 @@ 作者 - + {{ portfolio.portfolioAuthorName }} @@ -60,7 +60,7 @@ export default { validate({params, store}) { return params.portfolio_id && !isNaN(Number(params.portfolio_id)) }, - fetch() { + async fetch() { let {store, params, query, error} = this.$nuxt.context params.page = query.page || 1 return Promise.all([ @@ -89,7 +89,7 @@ export default { isAuthor() { let account = this.$store.state.auth.user?.nickname; if (account) { - if (account === this.portfolio.portfolioAuthor.userNickname) { + if (account === this.portfolio.portfolioAuthor?.userNickname) { return true; } }