feat: 支持 uTools list 模板

This commit is contained in:
muwoo
2021-07-09 12:37:35 +08:00
parent f34d93691d
commit b08f4fab54
11 changed files with 144 additions and 10 deletions

View File

@@ -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;
},

View File

@@ -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() {

View File

@@ -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')

View File

@@ -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],