From 39b8c23a734bc951d8ab9a07a63e45deb0c4a615 Mon Sep 17 00:00:00 2001 From: fofolee Date: Wed, 13 Apr 2022 23:05:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=9B=B4=E6=8E=A5=E6=96=B0?= =?UTF-8?q?=E5=BB=BA=E5=91=BD=E4=BB=A4=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/CommandCard.vue | 2 +- src/pages/ConfigurationPage.vue | 15 ++++++++++++--- src/pages/NewCommand.vue | 11 ----------- src/router/routes.js | 3 ++- 4 files changed, 15 insertions(+), 16 deletions(-) delete mode 100644 src/pages/NewCommand.vue diff --git a/src/components/CommandCard.vue b/src/components/CommandCard.vue index 63ae593..83cc17c 100644 --- a/src/components/CommandCard.vue +++ b/src/components/CommandCard.vue @@ -294,7 +294,7 @@ export default { editCommand() { let event = { type: "edit", - data: this.commandInfo.features.code, + data: this.commandInfo, }; this.$emit("commandChanged", event); }, diff --git a/src/pages/ConfigurationPage.vue b/src/pages/ConfigurationPage.vue index f17fa4c..3f085fc 100644 --- a/src/pages/ConfigurationPage.vue +++ b/src/pages/ConfigurationPage.vue @@ -176,7 +176,7 @@ v-model="isCommandEditorShow" persistent :maximized="maximizedToggle" - transition-show="slide-up" + :transition-show="newCommandDirect ? '' : 'slide-up'" transition-hide="slide-down" > @@ -297,6 +297,9 @@ export default { tabBarWidth() { return this.commandCardStyle === "mini" ? "0" : "80px"; }, + newCommandDirect() { + return this.$route.name === "newcommand"; + }, }, mounted() { this.initPage(); @@ -304,6 +307,12 @@ export default { methods: { // 初始化 initPage() { + // 如果从 newcommand 进入则直接新建命令 + if (this.newCommandDirect) { + if (quickcommand.enterData.type === "text") this.addNewCommand(); + else this.editCommand(JSON.parse(quickcommand.enterData.payload)); + this.$router.push("/configuration"); + } // 已启用的 features let activatedFeatures = this.getActivatedFeatures(); // 已启用的命令的 featureCode @@ -401,10 +410,10 @@ export default { ); }, // 编辑命令 - editCommand(code) { + editCommand(command) { this.commandEditorAction = { type: "edit", - data: this.allQuickCommands[code], + data: _.cloneDeep(command), }; this.isCommandEditorShow = true; }, diff --git a/src/pages/NewCommand.vue b/src/pages/NewCommand.vue deleted file mode 100644 index 478cdec..0000000 --- a/src/pages/NewCommand.vue +++ /dev/null @@ -1,11 +0,0 @@ - - - diff --git a/src/router/routes.js b/src/router/routes.js index 7f792bf..5b82e61 100644 --- a/src/router/routes.js +++ b/src/router/routes.js @@ -12,8 +12,9 @@ const routes = [{ }, { path: '/newcommand', + name: 'newcommand', component: () => - import ('pages/NewCommand.vue') + import ('pages/ConfigurationPage.vue') }, { path: '/:type(default|files|img|key|regex|window|professional)_:uid(\\w+)',