39 lines
709 B
Vue
39 lines
709 B
Vue
<template>
|
|
<div class="scroll-component" :id="id">
|
|
<div class="inner-scroll-component">
|
|
<slot></slot>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
const id = crypto.randomUUID();
|
|
|
|
function scrollToBottom()
|
|
{
|
|
setTimeout(() => {
|
|
const element = document.getElementById(id);
|
|
if(element)
|
|
{
|
|
element.scrollTo({top: element.scrollHeight, behavior: 'instant'});
|
|
}
|
|
}, 25)
|
|
}
|
|
|
|
defineExpose({
|
|
scrollToBottom
|
|
})
|
|
</script>
|
|
|
|
<style scoped>
|
|
.scroll-component {
|
|
height: 100%;
|
|
position: relative;
|
|
overflow: scroll;
|
|
}
|
|
.inner-scroll-component {
|
|
width: 100%;
|
|
position: absolute;
|
|
min-height: 100%;
|
|
}
|
|
</style> |