38 lines
885 B
Vue
38 lines
885 B
Vue
<script setup lang="ts">
|
|
import type { TrackingObject } from '#layers/types/api/common'
|
|
|
|
const { locale } = useI18n()
|
|
const { y: windowY } = useWindowScroll({ behavior: 'smooth' })
|
|
const { sendLog, useAnalyticsData } = useAnalytics()
|
|
|
|
const analytics = {
|
|
action_type: 'click',
|
|
click_item: 'TOP버튼',
|
|
click_sarea: 'TOP', // TODO: 확인 필요 컴포넌트 id가 뭔가염 뭔가염
|
|
} as TrackingObject
|
|
|
|
const showBtn = computed(() => windowY.value > 0)
|
|
|
|
const handleScrollToTop = () => {
|
|
windowY.value = 0
|
|
sendLog(locale.value, useAnalyticsData(analytics))
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<Transition name="fade">
|
|
<AtomsButtonCircle
|
|
v-show="showBtn"
|
|
class="btn-top"
|
|
sr-only="top"
|
|
@click="handleScrollToTop"
|
|
/>
|
|
</Transition>
|
|
</template>
|
|
|
|
<style scoped>
|
|
.btn-top {
|
|
@apply bg-[image:var(--button-top)] bg-center bg-cover bg-no-repeat;
|
|
}
|
|
</style>
|