From 431906a1bb5832c178f94351a3ceb4910d216ab0 Mon Sep 17 00:00:00 2001 From: fofolee Date: Sat, 9 Apr 2022 01:20:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=A9=BA=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 18 ++++++++++++------ src/pages/LoadingPage.vue | 5 +++++ src/router/routes.js | 28 +++++++++++++++++++--------- 3 files changed, 36 insertions(+), 15 deletions(-) create mode 100644 src/pages/LoadingPage.vue diff --git a/src/App.vue b/src/App.vue index 3508930..523772e 100644 --- a/src/App.vue +++ b/src/App.vue @@ -32,17 +32,23 @@ export default defineComponent({ } // 默认主题色 this.setCssVar("primary", this.$profile.primaryColor); + // 进入插件 utools.onPluginEnter((enter) => { // 暗黑模式 this.$q.dark.set(utools.isDarkColors()); // 路由跳转 quickcommand.enterData = enter; - this.$router.push({ - path: enter.code, - query: { - timestamp: new Date().getTime(), - }, - }); + this.$router.push(enter.code); + }); + // 退出插件 + utools.onPluginOut(() => { + // 切到空路由 + this.$router.push("loading"); + // 保存偏好 + this.$utools.putDB( + _.cloneDeep(this.$profile), + this.$utools.DBPRE.CFG + "preferences" + ); }); }, }, diff --git a/src/pages/LoadingPage.vue b/src/pages/LoadingPage.vue new file mode 100644 index 0000000..4e7218d --- /dev/null +++ b/src/pages/LoadingPage.vue @@ -0,0 +1,5 @@ + diff --git a/src/router/routes.js b/src/router/routes.js index 3b4491f..98438dd 100644 --- a/src/router/routes.js +++ b/src/router/routes.js @@ -1,31 +1,41 @@ -const routes = [ - { +const routes = [{ path: '/configuration', - component: () => import('pages/ConfigurationPage.vue') + component: () => + import ('pages/ConfigurationPage.vue') }, { path: '/code', - component: () => import('pages/RunCodePage.vue') + component: () => + import ('pages/RunCodePage.vue') }, { path: '/newcommand', - component: () => import('pages/NewCommand.vue') + component: () => + import ('pages/NewCommand.vue') }, { path: '/:type(default|files|key|regex|window|professional)_:uid(\\w+)', - component: () => import('pages/CommandPage.vue') + component: () => + import ('pages/CommandPage.vue') }, { path: '/panel_:tags(\\w+)', - component: () => import('pages/ConfigurationPage.vue') + component: () => + import ('pages/ConfigurationPage.vue') }, { path: '/needupdate', name: 'needupdate', props: true, - component: () => import('pages/updateWarningPage.vue') + component: () => + import ('pages/updateWarningPage.vue') + }, + { + path: '/loading', + component: () => + import ('pages/LoadingPage.vue') } ] -export default routes +export default routes \ No newline at end of file