mirror of
https://github.com/rubickCenter/rubick
synced 2025-12-24 19:39:27 +08:00
bugfix: 修复已知bug
This commit is contained in:
@@ -39,11 +39,15 @@
|
||||
class="icon-more"
|
||||
type="more"
|
||||
/>
|
||||
<img
|
||||
class="icon-tool"
|
||||
v-if="selected && selected.icon"
|
||||
:src="selected.icon"
|
||||
/>
|
||||
<div v-if="selected && selected.icon" style="position: relative">
|
||||
<a-spin v-show="pluginLoading" class="loading">
|
||||
<a-icon slot="indicator" type="loading" style="font-size: 42px" spin />
|
||||
</a-spin>
|
||||
<img
|
||||
class="icon-tool"
|
||||
:src="selected.icon"
|
||||
/>
|
||||
</div>
|
||||
<div v-else class="rubick-logo">
|
||||
<img src="./assets/imgs/logo.png" />
|
||||
</div>
|
||||
@@ -163,7 +167,18 @@ export default {
|
||||
feature.forEach((fe) => {
|
||||
const cmd = searchKeyValues(fe.cmds, args)[0];
|
||||
const systemPlugin = fileLists.filter(
|
||||
(plugin) => plugin.name.indexOf(args) >= 0
|
||||
(plugin) => {
|
||||
let has = false;
|
||||
plugin.keyWords.some(keyWord => {
|
||||
if (keyWord.toLocaleUpperCase().indexOf(args.toLocaleUpperCase()) >= 0) {
|
||||
has = keyWord;
|
||||
plugin.name = keyWord;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
return has;
|
||||
}
|
||||
)[0];
|
||||
if (cmd) {
|
||||
config = {
|
||||
@@ -325,6 +340,7 @@ export default {
|
||||
"searchValue",
|
||||
"subPlaceHolder",
|
||||
"pluginInfo",
|
||||
"pluginLoading",
|
||||
]),
|
||||
showOptions() {
|
||||
// 有选项值,且不在显示主页
|
||||
@@ -449,5 +465,10 @@ export default {
|
||||
font-weight: bold;
|
||||
cursor: pointer;
|
||||
}
|
||||
.loading {
|
||||
position:absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
<template>
|
||||
<div>
|
||||
<webview v-if="!pluginInfo.subType" id="webview" :src="path" :preload="preload"></webview>
|
||||
<webview
|
||||
v-if="!pluginInfo.subType"
|
||||
id="webview"
|
||||
:src="path"
|
||||
:preload="preload"
|
||||
></webview>
|
||||
<div v-else>
|
||||
<webview id="webview" :src="templatePath" :preload="preload"></webview>
|
||||
</div>
|
||||
@@ -29,6 +34,14 @@ export default {
|
||||
this.webview.addEventListener('dom-ready', () => {
|
||||
this.webview.send('onPluginReady', this.pluginInfo);
|
||||
this.webview.send('onPluginEnter', this.pluginInfo);
|
||||
this.commonUpdate({
|
||||
pluginLoading: true,
|
||||
});
|
||||
});
|
||||
this.webview.addEventListener('did-finish-load', () => {
|
||||
this.commonUpdate({
|
||||
pluginLoading: false,
|
||||
});
|
||||
});
|
||||
this.setSubPlaceHolder('Hi, Rubick');
|
||||
this.webview.addEventListener('ipc-message', (event) => {
|
||||
@@ -83,10 +96,6 @@ export default {
|
||||
methods: {
|
||||
...mapMutations('main', ['setSubPlaceHolder', 'commonUpdate']),
|
||||
},
|
||||
beforeRouteUpdate() {
|
||||
this.path = `File://${this.pluginInfo.sourceFile}`;
|
||||
this.webview.send('onPluginEnter', this.pluginInfo);
|
||||
},
|
||||
beforeDestroy() {
|
||||
const webview = document.querySelector('webview');
|
||||
webview && webview.send('onPluginOut', this.pluginInfo)
|
||||
@@ -97,10 +106,13 @@ export default {
|
||||
return (this.devPlugins.filter(plugin => plugin.name === this.pluginInfo.name)[0] || {}).features
|
||||
},
|
||||
path() {
|
||||
this.$nextTick(() => {
|
||||
this.webview && this.webview.send('onPluginEnter', this.pluginInfo);
|
||||
});
|
||||
return `File://${this.pluginInfo.sourceFile}`
|
||||
},
|
||||
templatePath() {
|
||||
return `File://${path.join(__static, './plugins/tpl/index.html')}?code=${JSON.parse(this.pluginInfo.detail).code}&targetFile=${encodeURIComponent(this.pluginInfo.sourceFile)}&preloadPath=${this.pluginInfo.preload}`;
|
||||
return `File://${path.join(__static, './plugins/tpl/index.html')}?code=${this.pluginInfo.detail.code}&targetFile=${encodeURIComponent(this.pluginInfo.sourceFile)}&preloadPath=${this.pluginInfo.preload}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,9 +22,9 @@ const state = {
|
||||
searchValue: '',
|
||||
devPlugins: mergePlugins(sysFile.getUserPlugins() || []),
|
||||
subPlaceHolder: '',
|
||||
pluginLoading: true,
|
||||
pluginInfo: (() => {
|
||||
try {
|
||||
console.log(window.pluginInfo);
|
||||
return window.pluginInfo || {};
|
||||
} catch (e) {}
|
||||
})()
|
||||
|
||||
Reference in New Issue
Block a user