build(projects): 升级依赖、修复T标签右键菜单连续显示问题

ISSUES CLOSED: #125
This commit is contained in:
Soybean
2022-08-24 00:15:46 +08:00
parent 1ad92a2d1b
commit 639c4458be
2 changed files with 24 additions and 6 deletions

View File

@ -18,10 +18,11 @@
</component>
</div>
<context-menu
v-model:visible="dropdown.visible"
:visible="dropdown.visible"
:current-path="dropdown.currentPath"
:x="dropdown.x"
:y="dropdown.y"
@update:visible="handleDropdownVisible"
/>
</template>
@ -76,14 +77,31 @@ function setDropdown(x: number, y: number, currentPath: string) {
Object.assign(dropdown, { x, y, currentPath });
}
let isClickContextMenu = false;
function handleDropdownVisible(visible: boolean) {
if (!isClickContextMenu) {
dropdown.visible = visible;
}
}
/** 点击右键菜单 */
async function handleContextMenu(e: MouseEvent, fullPath: string) {
e.preventDefault();
const { clientX, clientY } = e;
isClickContextMenu = true;
const DURATION = dropdown.visible ? 150 : 0;
hideDropdown();
setDropdown(clientX, clientY, fullPath);
await nextTick();
showDropdown();
setTimeout(() => {
setDropdown(clientX, clientY, fullPath);
showDropdown();
isClickContextMenu = false;
}, DURATION);
}
watch(