diff --git a/src/App.vue b/src/App.vue index 2b0b923..ef37202 100644 --- a/src/App.vue +++ b/src/App.vue @@ -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); }); }, }, diff --git a/src/pages/CodeRunner.vue b/src/components/CodeRunner.vue similarity index 97% rename from src/pages/CodeRunner.vue rename to src/components/CodeRunner.vue index 9f52b05..75d98ad 100644 --- a/src/pages/CodeRunner.vue +++ b/src/components/CodeRunner.vue @@ -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(); // 保存本次编辑记录 diff --git a/src/pages/CommandPage.vue b/src/pages/CommandPage.vue index 7016939..99610b2 100644 --- a/src/pages/CommandPage.vue +++ b/src/pages/CommandPage.vue @@ -3,5 +3,7 @@ diff --git a/src/pages/RunCodePage.vue b/src/pages/RunCodePage.vue new file mode 100644 index 0000000..999fa3f --- /dev/null +++ b/src/pages/RunCodePage.vue @@ -0,0 +1,21 @@ + + + diff --git a/src/pages/NeedUpdate.vue b/src/pages/updateWarningPage.vue similarity index 100% rename from src/pages/NeedUpdate.vue rename to src/pages/updateWarningPage.vue diff --git a/src/router/routes.js b/src/router/routes.js index 49c2012..0b5923c 100644 --- a/src/router/routes.js +++ b/src/router/routes.js @@ -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') } ]