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) ); } },