fix: 取消文件管理器右键菜单禁用状态
This commit is contained in:
@@ -26,7 +26,7 @@ const { isMobile } = useDeviceDetection();
|
|||||||
const emit = defineEmits(['item-click', 'close-request']); // 添加 close-request
|
const emit = defineEmits(['item-click', 'close-request']); // 添加 close-request
|
||||||
|
|
||||||
const handleItemClick = (item: ContextMenuItem) => {
|
const handleItemClick = (item: ContextMenuItem) => {
|
||||||
if (!item.disabled && item.action) {
|
if (item.action) {
|
||||||
item.action(); // 只有当 action 存在时才执行
|
item.action(); // 只有当 action 存在时才执行
|
||||||
emit('close-request'); // <-- 发出关闭请求
|
emit('close-request'); // <-- 发出关闭请求
|
||||||
}
|
}
|
||||||
@@ -78,9 +78,7 @@ 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',
|
||||||
subItem.disabled
|
'hover:bg-primary/10 hover:text-primary' // 始终应用可点击样式
|
||||||
? 'text-text-secondary cursor-not-allowed opacity-60'
|
|
||||||
: 'hover:bg-primary/10 hover:text-primary'
|
|
||||||
]"
|
]"
|
||||||
>
|
>
|
||||||
{{ subItem.label }}
|
{{ subItem.label }}
|
||||||
@@ -92,9 +90,7 @@ 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',
|
||||||
menuItem.disabled
|
'hover:bg-primary/10 hover:text-primary' // 始终应用可点击样式
|
||||||
? 'text-text-secondary cursor-not-allowed opacity-60'
|
|
||||||
: 'hover:bg-primary/10 hover:text-primary'
|
|
||||||
]"
|
]"
|
||||||
>
|
>
|
||||||
{{ menuItem.label }}
|
{{ menuItem.label }}
|
||||||
@@ -119,9 +115,7 @@ 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',
|
||||||
subItem.disabled
|
'hover:bg-primary/10 hover:text-primary' // 始终应用可点击样式
|
||||||
? 'text-text-secondary cursor-not-allowed opacity-60'
|
|
||||||
: 'hover:bg-primary/10 hover:text-primary'
|
|
||||||
]"
|
]"
|
||||||
>
|
>
|
||||||
{{ subItem.label }}
|
{{ subItem.label }}
|
||||||
|
|||||||
Reference in New Issue
Block a user