🐛 #80 修复 win depd bug

This commit is contained in:
muwoo
2022-01-13 18:38:44 +08:00
parent e5ff219685
commit 1e73ab5ee6
5 changed files with 35 additions and 38 deletions

View File

@@ -1,6 +1,6 @@
<template>
<div v-show="!!options.length && (searchValue || !!clipboardFile.length) && !currentPlugin.name" class="options" ref="scrollDom">
<a-list item-layout="horizontal" :dataSource="options">
<a-list item-layout="horizontal" :dataSource="sort(options)">
<template #renderItem="{ item, index }">
<a-list-item
@click="() => item.click()"
@@ -66,6 +66,20 @@ const renderDesc = (desc) => {
}
return desc;
};
const sort = (options) => {
for (let i = 0; i < options.length; i++) {
for (let j = i + 1; j < options.length; j++) {
if (options[j].zIndex > options[i].zIndex) {
let temp = options[i];
options[i] = options[j];
options[j] = temp;
}
}
}
return options;
};
</script>
<style lang="less">

View File

@@ -178,7 +178,7 @@ const changeHideOnBlur = () => {
const getIcon = () => {
if (props.clipboardFile[0].dataUrl) return props.clipboardFile[0].dataUrl;
return props.clipboardFile[0].isFile ? require("../assets/file.png") : require("../assets/folder.png")
}
};
const newWindow = () => {
ipcRenderer.send("msg-trigger", {

View File

@@ -54,6 +54,7 @@ const optionsManager = ({
icon: plugin.logo,
desc: fe.explain,
type: plugin.pluginType,
zIndex: cmd.label ? 0 : 1, // 排序权重
click: () => {
pluginClickEvent({
plugin,
@@ -61,10 +62,10 @@ const optionsManager = ({
cmd,
ext: cmd.type
? {
code: fe.code,
type: cmd.type || "text",
payload: searchValue.value,
}
code: fe.code,
type: cmd.type || "text",
payload: searchValue.value,
}
: null,
openPlugin,
});
@@ -101,14 +102,17 @@ const optionsManager = ({
}
})
.map((plugin) => {
plugin.click = () => {
openPlugin(plugin);
return {
...plugin,
zIndex: 1,
click: () => {
openPlugin(plugin);
},
};
return plugin;
}),
];
return options;
}
};
watch(searchValue, () => search(searchValue.value));
// search Input operation
@@ -126,7 +130,12 @@ const optionsManager = ({
optionsRef.value = options;
};
const { searchFocus, clipboardFile, clearClipboardFile, readClipboardContent } = useFocus({
const {
searchFocus,
clipboardFile,
clearClipboardFile,
readClipboardContent,
} = useFocus({
currentPlugin,
optionsRef,
openPlugin,