From 054aca172e313a5ff62efa177616f0bcb99ecef0 Mon Sep 17 00:00:00 2001 From: Link Date: Sat, 7 Nov 2020 17:47:41 +0800 Subject: [PATCH] fix: lyrics are misplaced after minimization --- src/components/teleport-layout/index.tsx | 1 + .../footer/component/lyrice-flash/index.tsx | 8 ++++++-- src/pages/footer/component/lyrice/index.tsx | 16 +++++++++++++--- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/components/teleport-layout/index.tsx b/src/components/teleport-layout/index.tsx index 29f213de..cb83575d 100644 --- a/src/components/teleport-layout/index.tsx +++ b/src/components/teleport-layout/index.tsx @@ -27,6 +27,7 @@ export const TeleportToAny = defineComponent({ return () => (
( - -
+ +
{lyrice.value.map((item, i) => (
(NAMESPACED) + const LayoutModule = uesModuleStore(LayoutNamespace) + + const { screenSize } = toRefs(LayoutModule.useState()) const lyrice = computed(() => useGetter('musicLyrics')) const { currentTime } = toRefs(useState()) @@ -60,6 +69,7 @@ export const PlayLyrice = defineComponent({ nextTick(() => { offset.value = contanier.value.clientHeight / 2 - 50 disabled.value = !visible.value + console.log(offset.value, disabled.value) }) } @@ -69,11 +79,11 @@ export const PlayLyrice = defineComponent({ } }) - const resize = () => { - if (visible.value) { + const resize = debounce(() => { + if (visible.value && screenSize.value !== Size.SM) { updateOffset() } - } + }, 100) onMounted(() => { on(window, 'resize', resize)