2022-12-17 23:15:41 +01:00
|
|
|
<script setup lang="ts">
|
2024-03-05 15:48:58 +01:00
|
|
|
const { as = 'div', active } = defineProps<{
|
|
|
|
as: any
|
|
|
|
active: boolean
|
|
|
|
}>()
|
|
|
|
|
2022-12-17 23:15:41 +01:00
|
|
|
const el = ref()
|
|
|
|
|
|
|
|
watch(() => active, (active) => {
|
|
|
|
const _el = unrefElement(el)
|
|
|
|
|
|
|
|
if (active && _el)
|
|
|
|
_el.scrollIntoView({ block: 'nearest', inline: 'start' })
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<component :is="as" ref="el">
|
|
|
|
<slot />
|
|
|
|
</component>
|
|
|
|
</template>
|