From 7fb35e7c2ffc5765e14cc750cc058f1cbf522328 Mon Sep 17 00:00:00 2001 From: fofolee Date: Mon, 7 Aug 2023 13:23:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=90=9C=E7=B4=A2=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E6=8E=A8=E9=80=81=E9=99=90=E5=88=B6=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/CommandSideBar.vue | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/components/CommandSideBar.vue b/src/components/CommandSideBar.vue index e488bcb..c1f8f31 100644 --- a/src/components/CommandSideBar.vue +++ b/src/components/CommandSideBar.vue @@ -288,7 +288,6 @@ import specialVars from "../js/options/specialVars.js"; import platformTypes from "../js/options/platformTypes.js"; import iconPicker from "components/popup/IconPicker.vue"; import UserData from "components/popup/UserData.vue"; -let commandTypesOptions = Object.values(commandTypes); export default { components: { iconPicker, UserData }, @@ -306,9 +305,8 @@ export default { }, commandTypes: commandTypes, platformTypes: platformTypes, - commandTypesOptions: commandTypesOptions, currentMatchType: "关键字", - cmdType: commandTypesOptions[0], + cmdType: {}, cmdMatch: "", outputTypes: outputTypes, outputTypesOptions: Object.keys(outputTypes), @@ -323,13 +321,22 @@ export default { canCommandSave: Boolean, }, computed: { + commandTypesOptions() { + return this.currentCommand.features.mainPush + ? Object.values(commandTypes).filter( + (x) => x.name === "regex" || x.name === "over" + ) + : Object.values(commandTypes); + }, specialVarsOptions() { + if (this.currentCommand.features.mainPush) return [specialVars.input]; let x = Object.values(specialVars).filter( (x) => !x.label.match(this.cmdType.disabledSpecialVars) ); return x; }, outputTypesOptionsDy() { + if (this.currentCommand.features.mainPush) return ["text"]; switch (this.$parent.quickcommandInfo.program) { case "quickcommand": return _.without(this.outputTypesOptions, "terminal"); @@ -346,6 +353,11 @@ export default { this.currentCommand.output = val[0]; } }, + commandTypesOptions(val) { + if (!val.map((x) => x.name).includes(this.cmdType.name)) { + this.cmdType = val[0]; + } + }, }, methods: { init() { @@ -401,6 +413,7 @@ export default { this.cmdMatch = `/${this.cmdMatch}/`; }, insertSpecialVar(text) { + if (!text) return; this.$parent.$refs.editor.repacleEditorSelection(`'${text}'`); }, // 保存各类数据