Skip to content

Commit 37f2de6

Browse files
LukerSpringtree陆德靖
andauthored
fix(client): reposition dockingPanel dropdown on window resize (#479)
Co-authored-by: 陆德靖 <[email protected]>
1 parent bc97b34 commit 37f2de6

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

packages/client/src/components/common/DockingPanel.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { VueButton, VueDarkToggle, VueIcon, VueSelect } from '@vue/devtools-ui'
33
import { refreshCurrentPageData, rpc, useDevToolsState } from '@vue/devtools-core'
44
55
const router = useRouter()
6-
const route = useRoute()
76
87
const expandSidebar = computed({
98
get: () => devtoolsClientState.value.expandSidebar,

packages/client/src/components/common/SideNav.vue

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ const sidebarScrollable = computed(() => devtoolsClientState.value.scrollableSid
1212
const { enabledTabs, flattenedTabs } = useAllTabs()
1313
1414
const ITEM_HEIGHT = 45
15+
const INIT_DISTANCE = 6
16+
const DIF_DISTANCE = 200
17+
1518
const { height: windowHeight } = useWindowSize()
1619
const containerCapacity = computed(() => {
1720
const containerHeight = windowHeight.value - 130
@@ -40,6 +43,21 @@ onClickOutside(
4043
},
4144
{ detectIframe: true },
4245
)
46+
47+
const distance = ref(INIT_DISTANCE)
48+
49+
watch(
50+
() => devtoolsClientState.value.expandSidebar,
51+
(expandSidebar) => {
52+
if (expandSidebar) {
53+
distance.value = DIF_DISTANCE + INIT_DISTANCE
54+
}
55+
else {
56+
distance.value = INIT_DISTANCE - DIF_DISTANCE
57+
}
58+
},
59+
60+
)
4361
</script>
4462

4563
<template>
@@ -50,7 +68,7 @@ onClickOutside(
5068
<div
5169
sticky top-0 z-1 w-full p1 bg-base border="b base"
5270
>
53-
<VueDropdown placement="left-start" :distance="6" :skidding="5" trigger="click" :shown="showDocking" class="w-full">
71+
<VueDropdown placement="left-start" :distance :skidding="5" trigger="click" :shown="showDocking" class="w-full">
5472
<button
5573
ref="buttonDocking"
5674
flex="~ items-center justify-center gap-2"

0 commit comments

Comments
 (0)