perf: hide context menu in tree view when press 'esc'

This commit is contained in:
Lykin 2024-01-24 11:25:59 +08:00
parent edaef2a78c
commit 124d221b9f
2 changed files with 69 additions and 58 deletions

View File

@ -567,7 +567,11 @@ defineExpose({
</script>
<template>
<div :style="{ backgroundColor }" class="flex-box-v browser-tree-wrapper" @contextmenu="(e) => e.preventDefault()">
<div
:style="{ backgroundColor }"
class="flex-box-v browser-tree-wrapper"
@contextmenu="(e) => e.preventDefault()"
@keydown.esc="contextMenuParam.show = false">
<n-spin v-if="props.loading" class="fill-height" />
<n-empty v-else-if="!props.loading && isEmpty(data)" class="empty-content" />
<n-tree

View File

@ -479,6 +479,7 @@ const onCancelOpen = () => {
</script>
<template>
<div class="connection-tree-wrapper" @keydown.esc="contextMenuParam.show = false">
<n-empty
v-if="isEmpty(connectionStore.connections)"
:description="$t('interface.empty_server_list')"
@ -538,8 +539,14 @@ const onCancelOpen = () => {
trigger="manual"
@clickoutside="contextMenuParam.show = false"
@select="handleSelectContextMenu" />
</div>
</template>
<style lang="scss" scoped>
@import '@/styles/content';
.connection-tree-wrapper {
height: 100%;
overflow: hidden;
}
</style>