From 511cf114342cd51ebd606a9f5dfdb0f410538489 Mon Sep 17 00:00:00 2001 From: fofolee Date: Tue, 26 Apr 2022 17:11:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8D=E9=80=82=E7=94=A8=E5=BD=93=E5=89=8D?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E5=BC=8F=E5=8C=B9=E9=85=8D=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E4=B8=BA=E7=81=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/CommandCard.vue | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/components/CommandCard.vue b/src/components/CommandCard.vue index 1bb5af4..b35cb85 100644 --- a/src/components/CommandCard.vue +++ b/src/components/CommandCard.vue @@ -273,13 +273,19 @@ export default { (!this.isCommandActivated || !this.canCommandRun), }; }, + // 命令是否适合当前平台 + canCommandRunAtCurrentOS() { + let { platform } = this.commandInfo.features; + return !_.isEmpty(platform) && !platform.includes(window.processPlatform) + ? false + : true; + }, // 命令是否可直接运行, 无论 cmds 长度为多少,只运行 cmds[0] canCommandRun() { // 未启用 if (!this.isCommandActivated) return false; - let { platform, cmds } = this.commandInfo.features; - if (!_.isEmpty(platform) && !platform.includes(window.processPlatform)) - return false; + if (!this.canCommandRunAtCurrentOS) return false; + let { cmds } = this.commandInfo.features; // 窗口模式 if (cmds[0].type && cmds[0].type === "window") return false; return true; @@ -296,7 +302,7 @@ export default { // 匹配类型的颜色 matchTypeColor() { return (cmdType = "key") => { - return this.isCommandActivated + return this.canCommandRunAtCurrentOS && this.isCommandActivated ? this.commandTypes[cmdType].color : this.disabledColor; };