From cfdd5a7e7172318cf8950d89c89e7cd3405f157d Mon Sep 17 00:00:00 2001 From: fofolee Date: Sun, 3 Apr 2022 22:19:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=86=99=E6=B3=95=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/CommandCard.vue | 3 +-- src/pages/ConfigurationPage.vue | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/CommandCard.vue b/src/components/CommandCard.vue index 32ab991..748a44b 100644 --- a/src/components/CommandCard.vue +++ b/src/components/CommandCard.vue @@ -235,8 +235,7 @@ export default { // 默认命令不可删除 canCommandEdit() { if (utools.isDev()) return true; - let tags = this.commandInfo.tags; - return tags && tags.includes("默认") ? false : true; + return this.commandInfo.tags?.includes("默认") ? false : true; }, // 匹配类型的颜色 cmdBadgeColor() { diff --git a/src/pages/ConfigurationPage.vue b/src/pages/ConfigurationPage.vue index 4c1a3ba..1890f92 100644 --- a/src/pages/ConfigurationPage.vue +++ b/src/pages/ConfigurationPage.vue @@ -325,7 +325,8 @@ export default { ); default: return commands.filter( - (cmd) => cmd.tags && cmd.tags.includes(this.currentTag) + // 可选链操作符 + (cmd) => cmd.tags?.includes(this.currentTag) ); } },