<template>
    <div class="srcoll" ref="scroll_elem">
        <slot />
    </div>
</template>
  
<script lang="ts">
export default {
    name: "BCRecordScroll",
};
</script>
  
<script lang="ts" setup>
import { ref, onActivated } from "vue";
import { onBeforeRouteLeave } from "vue-router";
const scroll_distance = ref(0);
const scroll_elem = ref<HTMLElement>(null);
onBeforeRouteLeave(() => {
    scroll_distance.value = scroll_elem.value.scrollTop;
});
onActivated(() => {
    scroll_elem.value.scrollTop = scroll_distance.value;
});
</script>
  
<style lang="scss" scoped>
.srcoll {
    height: 100%;
    @extend %overflow-auto;
}
</style>
  