feat: 支持打开文件所在的文件夹 调整打开文件的图标

This commit is contained in:
ZiuChen 2022-09-04 21:49:24 +08:00
parent 4cedb3a60a
commit 70469cd4b0
3 changed files with 12 additions and 4 deletions

View File

@ -248,6 +248,7 @@ window.copy = copy
window.paste = paste
window.remove = remove
window.openFile = utools.shellOpenPath
window.openFileFolder = utools.shellShowItemInFolder
window.getIcon = utools.getFileIcon
window.focus = focus
window.toTop = toTop

View File

@ -51,10 +51,11 @@
<template v-for="{ id, title, icon } of operation">
<div
v-if="
(id !== 'collect' && id !== 'view' && id !== 'un-collect') ||
(id !== 'collect' && id !== 'view' && id !== 'open-folder' && id !== 'un-collect') ||
(id === 'collect' && item.collect !== true) ||
(id === 'un-collect' && item.collect === true) ||
(id === 'view' && item.type !== 'image')
(id === 'view' && item.type !== 'image') ||
(id === 'open-folder' && item.type === 'file') ||
(id === 'un-collect' && item.collect === true)
"
:class="id"
:title="title"
@ -103,6 +104,7 @@ const handleMouseOver = (index) => (activeIndex.value = index)
const operation = [
{ id: 'copy', title: '复制', icon: '📄' },
{ id: 'view', title: '查看全部', icon: '💬' },
{ id: 'open-folder', title: '打开文件夹', icon: '📁' },
{ id: 'collect', title: '收藏', icon: '⭐' },
{ id: 'un-collect', title: '取消收藏', icon: '📤' },
{ id: 'remove', title: '删除', icon: '❌' }
@ -115,6 +117,11 @@ const handleOperateClick = ({ id, item }) => {
case 'view':
emit('onDataChange', item)
break
case 'open-folder':
const { data } = item
const fl = JSON.parse(data)
window.openFileFolder(fl[0].path) //
break
case 'collect':
item.collect = true
window.db.updateDataBaseLocal(db)

View File

@ -7,7 +7,7 @@
&:hover {
text-decoration: underline;
&::after {
content: '📤';
content: '📝';
}
}
.clip-file-icon {