ref: db api 修改为同步

This commit is contained in:
muwoo
2021-07-12 12:54:08 +08:00
parent 70bbe8ab49
commit e4e7dbbe9a
7 changed files with 151 additions and 51 deletions

View File

@@ -66,7 +66,7 @@ export default {
return dbData.find(d => d._id === key) || {};
},
remove({key}) {
key = typeof key === 'object' ? key.id : key;
key = typeof key === 'object' ? key._id : key;
let dbData = getData(dbPath);
let find = false;
dbData.some((d, i) => {

View File

@@ -99,6 +99,9 @@ export default {
ipcRenderer.on('new-window', this.newWindow);
// 超级面板打开插件
ipcRenderer.on('superPanel-openPlugin', (e, args) => {
ipcRenderer.send('msg-trigger', {
type: 'showMainWindow',
});
this.openPlugin({
cmd: args.cmd,
plugin: args.plugin,

View File

@@ -68,6 +68,19 @@ export default {
}),
});
}
if (event.channel === 'removeFeature') {
this.commonUpdate({
devPlugins: this.devPlugins.map(plugin => {
if (plugin.name === this.query.name) {
return {
...plugin,
features: plugin.features.filter(fe => fe.code !== event.args[0].code)
}
}
return plugin;
}),
});
}
})
},
methods: {

View File

@@ -1,7 +1,7 @@
<template>
<div class="dev-container">
<div class="dev-detail" v-if="devPlugin.length">
<a-menu v-model="currentSelect" style="width: 200px; height: 100%" mode="vertical">
<a-menu v-model="currentSelect" style="width: 256px; height: 100%" mode="vertical">
<a-menu-item @click="currentSelect = [index]" v-for="(plugin, index) in devPlugin" :key="index">
<div class="menu-item">
<img width="40" height="40" :src="plugin.icon" />
@@ -160,6 +160,10 @@ export default {
}
.desc {
color: #999;
width: 180px;
overflow: hidden;
text-overflow:ellipsis;
white-space: nowrap;
}
}
}
@@ -170,11 +174,12 @@ export default {
width: 100%;
}
.plugin-detail {
padding: 20px;
padding: 20px 20px 0 20px;
box-sizing: border-box;
flex: 1;
width: 500px;
.detail-container {
height: 340px;
height: 320px;
overflow: auto;
max-height: 320px;
width: 100%;
@@ -202,6 +207,8 @@ export default {
.desc-item {
border-bottom: 1px solid #ddd;
padding: 10px 0;
width: 100%;
overflow: auto;
.desc-title {
display: flex;
align-items: center;

View File

@@ -111,9 +111,10 @@ export default {
overflow: auto;
}
.plugin-detail {
padding: 20px;
padding: 20px 20px 0 20px;
box-sizing: border-box;
flex: 1;
height: 100%;
.plugin-top {
display: flex;
align-items: flex-start;