Fixed lyrics
This commit is contained in:
1 parent
b778ea9eda
commit
a46f289865
1 file changed
+12
-9
@@ -6,6 +6,7 @@ const { animationDuration, offset, showScrollBar } = defineProps<{
|
|||||||
}>()
|
}>()
|
||||||
|
|
||||||
const song = useSong()
|
const song = useSong()
|
||||||
|
const fullscreen = useFullscreen()
|
||||||
const { secondsPlayed } = usePlayer()
|
const { secondsPlayed } = usePlayer()
|
||||||
|
|
||||||
const parsedLyrics = computed(() => {
|
const parsedLyrics = computed(() => {
|
||||||
@@ -45,19 +46,21 @@ const scrollActiveIndex = computed(() => {
|
|||||||
return index
|
return index
|
||||||
})
|
})
|
||||||
|
|
||||||
const height = ref(0)
|
const height = ref<number>()
|
||||||
|
|
||||||
watch(song, () => {
|
watch(
|
||||||
const trackDisplay = document.querySelector(".track-display")
|
fullscreen,
|
||||||
|
async () => {
|
||||||
|
await nextTick()
|
||||||
|
|
||||||
if (!trackDisplay) return
|
const trackDisplay = document.querySelector(".track-display")
|
||||||
|
|
||||||
const resizeObserver = new ResizeObserver((entries) => {
|
if (!trackDisplay) return
|
||||||
height.value = entries[0]!.target.clientHeight
|
|
||||||
})
|
|
||||||
|
|
||||||
resizeObserver.observe(trackDisplay)
|
height.value = trackDisplay.clientHeight
|
||||||
})
|
},
|
||||||
|
{ immediate: true },
|
||||||
|
)
|
||||||
|
|
||||||
const transformY = computed(() => {
|
const transformY = computed(() => {
|
||||||
if (activeIndex.value < 0) return 0
|
if (activeIndex.value < 0) return 0
|
||||||
|
|||||||
Reference in new issue
Block a user