From 641f87e0ec38514568fd5cd27fc4d52a57b35ef1 Mon Sep 17 00:00:00 2001 From: Hakadao Date: Thu, 22 Feb 2024 12:28:02 +0800 Subject: [PATCH] fix(VideoCard): bug fixes (#316) (#319) * fix(VideoCard): fix double page open on author's name click (#315) * fix(VideoCard): ensure clicking on bangumi name or avatar goes to the right page --- src/components/VideoCard/VideoCard.vue | 26 ++++++++++++------- .../Home/components/SubscribedSeries.vue | 1 + 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/components/VideoCard/VideoCard.vue b/src/components/VideoCard/VideoCard.vue index d26ab464..0ee19675 100644 --- a/src/components/VideoCard/VideoCard.vue +++ b/src/components/VideoCard/VideoCard.vue @@ -13,6 +13,8 @@ interface Props { cover: string author?: string authorFace?: string + /** If you set the `authorUrl`, clicking the author's name or avatar will navigate to this url */ + authorUrl?: string mid?: number view?: number viewStr?: string @@ -49,6 +51,15 @@ const videoUrl = computed(() => { return '' }) +const authorJumpUrl = computed(() => { + if (props.authorUrl) + return props.authorUrl + else if (props.mid) + return `//space.bilibili.com/${props.mid}` + else + return '' +}) + const isDislike = ref(false) const isInWatchLater = ref(false) const isHover = ref(false) @@ -74,10 +85,6 @@ watch(() => isHover.value, (newValue) => { } }) -function gotoChannel(mid: number) { - window.open(`//space.bilibili.com/${mid}`) -} - function toggleWatchLater() { if (!isInWatchLater.value) { browser.runtime.sendMessage({ @@ -316,7 +323,7 @@ function handelMouseLeave() { v-if="authorFace" m="r-4" w="40px" h="40px" rounded="1/2" overflow="hidden" object="center cover" bg="$bew-fill-4" cursor="pointer" - :href="`//space.bilibili.com/${mid}`" target="_blank" rel="noopener noreferrer" + :href="authorJumpUrl" target="_blank" rel="noopener noreferrer" @click.stop="" >
- {{ author }} - +