mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-09 23:16:18 +08:00
结构调整
This commit is contained in:
parent
661654a4cf
commit
79e7ffc099
13
src/App.vue
13
src/App.vue
@ -30,17 +30,8 @@ export default defineComponent({
|
|||||||
// 暗黑模式
|
// 暗黑模式
|
||||||
this.$q.dark.set(utools.isDarkColors());
|
this.$q.dark.set(utools.isDarkColors());
|
||||||
// 路由跳转
|
// 路由跳转
|
||||||
let routeData = {
|
quickcommand.enterData = enter
|
||||||
from: "uTools",
|
this.$router.push(enter.code);
|
||||||
action: "run",
|
|
||||||
data: enter,
|
|
||||||
};
|
|
||||||
this.$router.push({
|
|
||||||
name: enter.code,
|
|
||||||
params: {
|
|
||||||
data: JSON.stringify(routeData),
|
|
||||||
},
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -185,9 +185,11 @@ export default {
|
|||||||
runResult: "",
|
runResult: "",
|
||||||
runResultStatus: true,
|
runResultStatus: true,
|
||||||
resultMaxLength: 10000,
|
resultMaxLength: 10000,
|
||||||
routeData: JSON.parse(this.$route.params.data),
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
props: {
|
||||||
|
action: Object,
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.init();
|
this.init();
|
||||||
},
|
},
|
||||||
@ -205,14 +207,15 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
init() {
|
init() {
|
||||||
this.bindKeys();
|
this.bindKeys();
|
||||||
|
|
||||||
let quickCommandInfo =
|
let quickCommandInfo =
|
||||||
this.routeData.action === "edit"
|
this.action.type === "edit"
|
||||||
? this.routeData.data
|
? this.action.data
|
||||||
: this.$utools.getDB(this.$utools.DBPRE.CFG + "codeHistory");
|
: this.$utools.getDB(this.$utools.DBPRE.CFG + "codeHistory");
|
||||||
Object.assign(this.quickcommandInfo, quickCommandInfo)
|
Object.assign(this.quickcommandInfo, quickCommandInfo);
|
||||||
this.$refs.editor.setEditorValue(quickCommandInfo.cmd);
|
this.$refs.editor.setEditorValue(quickCommandInfo.cmd);
|
||||||
// 只有新建或运行时才保存记录
|
// 只有新建或运行时才保存记录
|
||||||
if (this.routeData.action === "edit") return;
|
if (this.action.type === "edit") return;
|
||||||
utools.onPluginOut(() => {
|
utools.onPluginOut(() => {
|
||||||
this.quickcommandInfo.cmd = this.$refs.editor.getEditorValue();
|
this.quickcommandInfo.cmd = this.$refs.editor.getEditorValue();
|
||||||
// 保存本次编辑记录
|
// 保存本次编辑记录
|
@ -3,5 +3,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
console.log(quickcommand.enterData);
|
||||||
|
|
||||||
export default {};
|
export default {};
|
||||||
</script>
|
</script>
|
||||||
|
21
src/pages/RunCodePage.vue
Normal file
21
src/pages/RunCodePage.vue
Normal 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>
|
@ -1,22 +1,18 @@
|
|||||||
const routes = [
|
const routes = [
|
||||||
{
|
{
|
||||||
path: '/configuration',
|
path: '/configuration',
|
||||||
name: "configuration",
|
|
||||||
props: true,
|
|
||||||
component: () => import('pages/ConfigurationPage.vue')
|
component: () => import('pages/ConfigurationPage.vue')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/code',
|
path: '/code',
|
||||||
name: "code",
|
component: () => import('pages/RunCodePage.vue')
|
||||||
props: true,
|
|
||||||
component: () => import('pages/CodeRunner.vue')
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/newcommand',
|
path: '/newcommand',
|
||||||
component: () => import('pages/NewCommand.vue')
|
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')
|
component: () => import('pages/CommandPage.vue')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -27,7 +23,7 @@ const routes = [
|
|||||||
path: '/needupdate',
|
path: '/needupdate',
|
||||||
name: 'needupdate',
|
name: 'needupdate',
|
||||||
props: true,
|
props: true,
|
||||||
component: () => import('pages/NeedUpdate.vue')
|
component: () => import('pages/updateWarningPage.vue')
|
||||||
}
|
}
|
||||||
|
|
||||||
]
|
]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user