From 9c7a1560d9b3e76ce8fca0be56a3ec9a070c9fad Mon Sep 17 00:00:00 2001 From: Hakadao Date: Sun, 3 Sep 2023 12:35:56 +0800 Subject: [PATCH] perf: enhance `VideoCard` performance --- src/components/VideoCard-Perf.vue.bak | 367 -------------------------- src/components/VideoCard.vue | 313 ++++++++++++---------- 2 files changed, 177 insertions(+), 503 deletions(-) delete mode 100644 src/components/VideoCard-Perf.vue.bak diff --git a/src/components/VideoCard-Perf.vue.bak b/src/components/VideoCard-Perf.vue.bak deleted file mode 100644 index 8dc62f5f..00000000 --- a/src/components/VideoCard-Perf.vue.bak +++ /dev/null @@ -1,367 +0,0 @@ - - - - - diff --git a/src/components/VideoCard.vue b/src/components/VideoCard.vue index c5d789c4..7df4007b 100644 --- a/src/components/VideoCard.vue +++ b/src/components/VideoCard.vue @@ -26,6 +26,8 @@ const isDislike = ref(false) const isInWatchLater = ref(false) // const dislikeReasonId = ref(null) const showPopCtrl = ref(false) +const contentVisibility = ref<'auto' | 'visible'>('auto') +const mouseLeaveTimeOut = ref() function gotoChannel(mid: number) { window.open(`//space.bilibili.com/${mid}`) @@ -56,6 +58,17 @@ function toggleWatchLater() { } } +function handleMouseMove() { + contentVisibility.value = 'visible' +} + +function handelMouseLeave() { + clearTimeout(mouseLeaveTimeOut.value) + mouseLeaveTimeOut.value = setTimeout(() => { + contentVisibility.value = 'auto' + }, 300) +} + // function submitDislike( // reasonID: number, // goto: string, @@ -113,29 +126,33 @@ function toggleWatchLater() {