Skip to content

Commit

Permalink
feat: scroll to top when expanding
Browse files Browse the repository at this point in the history
  • Loading branch information
Akryum committed Sep 2, 2024
1 parent 2654078 commit b75329b
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,13 @@ async function onSubmitInstance(value: any) {
// Collapse
const collapse = useLocalStorage<boolean>('resource-instance-collapse', false)
const scroller = ref<HTMLElement | null>(null)
watchEffect(() => {
if (!collapse.value && scroller.value) {
scroller.value.scrollTop = 0
}
})
</script>

<template>
Expand Down Expand Up @@ -217,6 +224,7 @@ const collapse = useLocalStorage<boolean>('resource-instance-collapse', false)
</div>
<div
v-else-if="instanceStore.instance"
ref="scroller"
class="overflow-auto divide-y divide-gray-200 dark:divide-gray-800"
v-bind="$attrs"
>
Expand Down

0 comments on commit b75329b

Please sign in to comment.