From b08f4fab5401adecc77008314a4edb7cc44747c5 Mon Sep 17 00:00:00 2001 From: muwoo <2424880409@qq.com> Date: Fri, 9 Jul 2021 12:37:35 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=20uTools=20list=20?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/App.vue | 4 ++ src/renderer/pages/plugins/index.vue | 3 +- src/renderer/pages/search/subpages/plugin.vue | 2 +- src/renderer/store/modules/main.js | 8 ++- static/plugins/{doc => tpl}/doc.js | 0 .../{doc/doc-tpl.html => tpl/index.html} | 49 ++++++++++++++- static/plugins/{doc => tpl}/index.js | 5 +- static/plugins/tpl/list.js | 60 +++++++++++++++++++ static/plugins/vue-router.min.js | 6 ++ static/plugins/vue.min.js | 6 ++ static/preload.js | 11 +++- 11 files changed, 144 insertions(+), 10 deletions(-) rename static/plugins/{doc => tpl}/doc.js (100%) rename static/plugins/{doc/doc-tpl.html => tpl/index.html} (54%) rename static/plugins/{doc => tpl}/index.js (89%) create mode 100644 static/plugins/tpl/list.js create mode 100644 static/plugins/vue-router.min.js create mode 100644 static/plugins/vue.min.js diff --git a/src/renderer/App.vue b/src/renderer/App.vue index eb54438..117d0c6 100644 --- a/src/renderer/App.vue +++ b/src/renderer/App.vue @@ -162,6 +162,10 @@ export default { } }, changeCurrent(index) { + const webview = document.getElementById('webview'); + webview && webview.send('changeCurrent', index); + if (!this.options) return; + if (this.currentSelect + index > this.options.length - 1 || this.currentSelect + index < 0) return; this.currentSelect = this.currentSelect + index; }, diff --git a/src/renderer/pages/plugins/index.vue b/src/renderer/pages/plugins/index.vue index 5438094..625b8c3 100644 --- a/src/renderer/pages/plugins/index.vue +++ b/src/renderer/pages/plugins/index.vue @@ -24,7 +24,7 @@ export default { webview: null, query: this.$route.query, config: {}, - templatePath: `File://${path.join(__static, './plugins/doc/doc-tpl.html')}?code=${JSON.parse(this.$route.query.detail).code}&targetFile=${encodeURIComponent(this.$route.query.sourceFile)}`, + templatePath: `File://${path.join(__static, './plugins/tpl/index.html')}?code=${JSON.parse(this.$route.query.detail).code}&targetFile=${encodeURIComponent(this.$route.query.sourceFile)}&preloadPath=${this.$route.query.preload}`, } }, mounted() { @@ -75,7 +75,6 @@ export default { }, beforeRouteUpdate() { this.path = `File://${this.$route.query.sourceFile}`; - console.log(this.pluginInfo) this.webview.send('onPluginEnter', this.pluginInfo); }, beforeDestroy() { diff --git a/src/renderer/pages/search/subpages/plugin.vue b/src/renderer/pages/search/subpages/plugin.vue index 06df3be..f6d14aa 100644 --- a/src/renderer/pages/search/subpages/plugin.vue +++ b/src/renderer/pages/search/subpages/plugin.vue @@ -72,7 +72,7 @@ export default { computed: { ...mapState('main', ['devPlugins']), pluginDetail() { - return this.devPlugins[this.currentSelect] + return this.prodPlugin[this.currentSelect] }, prodPlugin() { return this.devPlugins.filter(plugin => plugin.type === 'prod') diff --git a/src/renderer/store/modules/main.js b/src/renderer/store/modules/main.js index 203ace7..09d4998 100644 --- a/src/renderer/store/modules/main.js +++ b/src/renderer/store/modules/main.js @@ -230,7 +230,13 @@ const actions = { id: uuidv4(), sourceFile: `${fileUrl}/${config.main}`, type: 'prod', - icon: payload.logo + icon: payload.logo, + subType: (() => { + if (config.main) { + return '' + } + return 'template'; + })() }; commit('commonUpdate', { devPlugins: [pluginConfig, ...state.devPlugins], diff --git a/static/plugins/doc/doc.js b/static/plugins/tpl/doc.js similarity index 100% rename from static/plugins/doc/doc.js rename to static/plugins/tpl/doc.js diff --git a/static/plugins/doc/doc-tpl.html b/static/plugins/tpl/index.html similarity index 54% rename from static/plugins/doc/doc-tpl.html rename to static/plugins/tpl/index.html index 12dce7a..379984e 100644 --- a/static/plugins/doc/doc-tpl.html +++ b/static/plugins/tpl/index.html @@ -4,8 +4,8 @@