Update FileManagerContextMenu.vue

This commit is contained in:
Baobhan Sith
2025-05-16 21:48:01 +08:00
parent 9761fb5109
commit 15cbf53a42
@@ -218,11 +218,23 @@ onUnmounted(() => {
@click.stop="handleItemClick(subItem)" @click.stop="handleItemClick(subItem)"
:class="[ :class="[
'px-4 py-1.5 cursor-pointer text-foreground text-sm flex items-center transition-colors duration-150 rounded mx-1', 'px-4 py-1.5 cursor-pointer text-foreground text-sm flex items-center transition-colors duration-150 rounded mx-1',
'hover:bg-primary/10 hover:text-primary' // 始终应用可点击样式 'hover:bg-primary/10 hover:text-primary'
]" ]"
> >
{{ subItem.label }} {{ subItem.label }}
</li> </li>
<!-- 如果 menuItem (作为移动端子菜单容器) "压缩", 在其子项后添加 "发送到" -->
<template v-if="menuItem.label === t('fileManager.contextMenu.compress')">
<li
@click.stop="handleSendToClick"
:class="[
'px-4 py-1.5 cursor-pointer text-foreground text-sm flex items-center transition-colors duration-150 rounded mx-1',
'hover:bg-primary/10 hover:text-primary'
]"
>
{{ t('fileManager.contextMenu.sendTo', 'Send to...') }}
</li>
</template>
</template> </template>
<!-- 否则按原有逻辑渲染一级菜单或带子菜单的一级菜单 --> <!-- 否则按原有逻辑渲染一级菜单或带子菜单的一级菜单 -->
<li <li
@@ -230,11 +242,23 @@ onUnmounted(() => {
@click.stop="handleItemClick(menuItem)" @click.stop="handleItemClick(menuItem)"
:class="[ :class="[
'px-4 py-1.5 cursor-pointer text-foreground text-sm flex items-center transition-colors duration-150 rounded mx-1', 'px-4 py-1.5 cursor-pointer text-foreground text-sm flex items-center transition-colors duration-150 rounded mx-1',
'hover:bg-primary/10 hover:text-primary' // 始终应用可点击样式 'hover:bg-primary/10 hover:text-primary'
]" ]"
> >
{{ menuItem.label }} {{ menuItem.label }}
</li> </li>
<!-- 如果普通菜单项是 "压缩", 在其后添加 "发送到" -->
<template v-if="!menuItem.submenu && menuItem.label === t('fileManager.contextMenu.compress')">
<li
@click.stop="handleSendToClick"
:class="[
'px-4 py-1.5 cursor-pointer text-foreground text-sm flex items-center transition-colors duration-150 rounded mx-1',
'hover:bg-primary/10 hover:text-primary'
]"
>
{{ t('fileManager.contextMenu.sendTo', 'Send to...') }}
</li>
</template>
<li <li
v-if="menuItem.submenu && !isMobile" v-if="menuItem.submenu && !isMobile"
class="px-4 py-1.5 text-foreground text-sm flex items-center justify-between transition-colors duration-150 rounded mx-1 hover:bg-primary/10 hover:text-primary relative" class="px-4 py-1.5 text-foreground text-sm flex items-center justify-between transition-colors duration-150 rounded mx-1 hover:bg-primary/10 hover:text-primary relative"
@@ -255,23 +279,26 @@ onUnmounted(() => {
@click.stop="handleItemClick(subItem)" @click.stop="handleItemClick(subItem)"
:class="[ :class="[
'px-4 py-1.5 cursor-pointer text-foreground text-sm flex items-center transition-colors duration-150 rounded mx-1', 'px-4 py-1.5 cursor-pointer text-foreground text-sm flex items-center transition-colors duration-150 rounded mx-1',
'hover:bg-primary/10 hover:text-primary' // 始终应用可点击样式 'hover:bg-primary/10 hover:text-primary'
]" ]"
> >
{{ subItem.label }} {{ subItem.label }}
</li> </li>
</ul> </ul>
</li> </li>
<!-- 如果桌面端带子菜单的项是 "压缩", 在其后添加 "发送到" -->
<template v-if="menuItem.submenu && !isMobile && menuItem.label === t('fileManager.contextMenu.compress')">
<li
@click.stop="handleSendToClick"
:class="[
'px-4 py-1.5 cursor-pointer text-foreground text-sm flex items-center transition-colors duration-150 rounded mx-1',
'hover:bg-primary/10 hover:text-primary'
]"
>
{{ t('fileManager.contextMenu.sendTo', 'Send to...') }}
</li>
</template>
</template> </template>
<li
@click.stop="handleSendToClick"
:class="[
'px-4 py-1.5 cursor-pointer text-foreground text-sm flex items-center transition-colors duration-150 rounded mx-1',
'hover:bg-primary/10 hover:text-primary'
]"
>
{{ t('fileManager.contextMenu.sendTo', 'Send to...') }}
</li>
</ul> </ul>
</div> </div>
<SendFilesModal <SendFilesModal