Skip to content

Commit

Permalink
feat(search): improve auto scroll
Browse files Browse the repository at this point in the history
  • Loading branch information
Akryum committed Mar 15, 2022
1 parent c99eea0 commit 29c20fe
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<script lang="ts" setup>
import { computed, PropType, ref, watch } from 'vue'
import { PropType, ref, toRefs } from 'vue'
import { useRouter } from 'vue-router'
import { Icon } from '@iconify/vue'
import { SearchResult } from '../../types'
import { onKeyboardShortcut } from '../../util/keyboard.js'
import BaseListItemLink from '../base/BaseListItemLink.vue'
import { useScrollOnActive } from '../../util/scroll'
const props = defineProps({
result: {
Expand All @@ -24,11 +25,8 @@ const emit = defineEmits({
const el = ref<HTMLDivElement>()
watch(() => props.selected, value => {
if (value) {
el.value.scrollIntoView()
}
})
const { selected } = toRefs(props)
useScrollOnActive(selected, el)
const router = useRouter()
Expand Down

0 comments on commit 29c20fe

Please sign in to comment.