添加直接新建命令功能

This commit is contained in:
fofolee 2022-04-13 23:05:35 +08:00
parent b4aa6f9837
commit 39b8c23a73
4 changed files with 15 additions and 16 deletions

View File

@ -294,7 +294,7 @@ export default {
editCommand() { editCommand() {
let event = { let event = {
type: "edit", type: "edit",
data: this.commandInfo.features.code, data: this.commandInfo,
}; };
this.$emit("commandChanged", event); this.$emit("commandChanged", event);
}, },

View File

@ -176,7 +176,7 @@
v-model="isCommandEditorShow" v-model="isCommandEditorShow"
persistent persistent
:maximized="maximizedToggle" :maximized="maximizedToggle"
transition-show="slide-up" :transition-show="newCommandDirect ? '' : 'slide-up'"
transition-hide="slide-down" transition-hide="slide-down"
> >
<q-card> <q-card>
@ -297,6 +297,9 @@ export default {
tabBarWidth() { tabBarWidth() {
return this.commandCardStyle === "mini" ? "0" : "80px"; return this.commandCardStyle === "mini" ? "0" : "80px";
}, },
newCommandDirect() {
return this.$route.name === "newcommand";
},
}, },
mounted() { mounted() {
this.initPage(); this.initPage();
@ -304,6 +307,12 @@ export default {
methods: { methods: {
// //
initPage() { 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 // features
let activatedFeatures = this.getActivatedFeatures(); let activatedFeatures = this.getActivatedFeatures();
// featureCode // featureCode
@ -401,10 +410,10 @@ export default {
); );
}, },
// //
editCommand(code) { editCommand(command) {
this.commandEditorAction = { this.commandEditorAction = {
type: "edit", type: "edit",
data: this.allQuickCommands[code], data: _.cloneDeep(command),
}; };
this.isCommandEditorShow = true; this.isCommandEditorShow = true;
}, },

View File

@ -1,11 +0,0 @@
<template>
<div>newCommand</div>
</template>
<script>
export default {
mounted() {
console.log(JSON.parse(localStorage["enterData"]));
},
};
</script>

View File

@ -12,8 +12,9 @@ const routes = [{
}, },
{ {
path: '/newcommand', path: '/newcommand',
name: 'newcommand',
component: () => component: () =>
import ('pages/NewCommand.vue') import ('pages/ConfigurationPage.vue')
}, },
{ {
path: '/:type(default|files|img|key|regex|window|professional)_:uid(\\w+)', path: '/:type(default|files|img|key|regex|window|professional)_:uid(\\w+)',