结构调整

This commit is contained in:
fofolee 2022-04-04 09:54:30 +08:00
parent 661654a4cf
commit 79e7ffc099
6 changed files with 36 additions and 23 deletions

View File

@ -30,17 +30,8 @@ export default defineComponent({
//
this.$q.dark.set(utools.isDarkColors());
//
let routeData = {
from: "uTools",
action: "run",
data: enter,
};
this.$router.push({
name: enter.code,
params: {
data: JSON.stringify(routeData),
},
});
quickcommand.enterData = enter
this.$router.push(enter.code);
});
},
},

View File

@ -185,9 +185,11 @@ export default {
runResult: "",
runResultStatus: true,
resultMaxLength: 10000,
routeData: JSON.parse(this.$route.params.data),
};
},
props: {
action: Object,
},
mounted() {
this.init();
},
@ -205,14 +207,15 @@ export default {
methods: {
init() {
this.bindKeys();
let quickCommandInfo =
this.routeData.action === "edit"
? this.routeData.data
this.action.type === "edit"
? this.action.data
: this.$utools.getDB(this.$utools.DBPRE.CFG + "codeHistory");
Object.assign(this.quickcommandInfo, quickCommandInfo)
Object.assign(this.quickcommandInfo, quickCommandInfo);
this.$refs.editor.setEditorValue(quickCommandInfo.cmd);
//
if (this.routeData.action === "edit") return;
if (this.action.type === "edit") return;
utools.onPluginOut(() => {
this.quickcommandInfo.cmd = this.$refs.editor.getEditorValue();
//

View File

@ -3,5 +3,7 @@
</template>
<script>
console.log(quickcommand.enterData);
export default {};
</script>

21
src/pages/RunCodePage.vue Normal file
View File

@ -0,0 +1,21 @@
<template>
<div>
<CodeRunner :action="action"></CodeRunner>
</div>
</template>
<script>
import CodeRunner from "components/CodeRunner";
export default {
components: { CodeRunner },
data() {
return {
action: {
type: "run",
data: {},
},
};
},
};
</script>

View File

@ -1,22 +1,18 @@
const routes = [
{
path: '/configuration',
name: "configuration",
props: true,
component: () => import('pages/ConfigurationPage.vue')
},
{
path: '/code',
name: "code",
props: true,
component: () => import('pages/CodeRunner.vue')
component: () => import('pages/RunCodePage.vue')
},
{
path: '/newcommand',
component: () => import('pages/NewCommand.vue')
},
{
path: '/:type(default|files|key|regex|window|professional)_:uid(\\w{11})',
path: '/:type(default|files|key|regex|window|professional)_:uid(\\w+)',
component: () => import('pages/CommandPage.vue')
},
{
@ -27,7 +23,7 @@ const routes = [
path: '/needupdate',
name: 'needupdate',
props: true,
component: () => import('pages/NeedUpdate.vue')
component: () => import('pages/updateWarningPage.vue')
}
]