Skip to content

Commit

Permalink
build(projects): 升级依赖、修复T标签右键菜单连续显示问题
Browse files Browse the repository at this point in the history
ISSUES CLOSED: #125
  • Loading branch information
honghuangdc committed Aug 23, 2022
1 parent 1ad92a2 commit 639c445
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -56,7 +56,7 @@
"@better-scroll/core": "^2.4.2",
"@soybeanjs/vue-admin-layout": "^1.1.1",
"@soybeanjs/vue-admin-tab": "^1.0.5",
"@vueuse/core": "^9.1.0",
"@vueuse/core": "^9.1.1",
"axios": "^0.27.2",
"clipboard": "^2.0.11",
"colord": "^2.9.3",
Expand Down Expand Up @@ -87,7 +87,7 @@
"@soybeanjs/eslint-config": "0.2.10",
"@types/bmapgl": "^0.0.5",
"@types/crypto-js": "^4.1.1",
"@types/node": "^18.7.9",
"@types/node": "^18.7.11",
"@types/qs": "^6.9.7",
"@types/ua-parser-js": "^0.7.36",
"@vitejs/plugin-vue": "^3.0.3",
Expand Down
26 changes: 22 additions & 4 deletions src/layouts/common/GlobalTab/components/TabDetail/index.vue
Expand Up @@ -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>

Expand Down Expand Up @@ -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(
Expand Down

1 comment on commit 639c445

@vercel
Copy link

@vercel vercel bot commented on 639c445 Aug 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.