Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…nto dev
  • Loading branch information
MengNianxiaoyao committed May 6, 2024
2 parents 137b4ea + e37caa7 commit 1900387
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/components/VideoCard/VideoCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@ const emit = defineEmits<{
const api = useApiClient()
// Used to click and control herf attribute
const isClick = ref<boolean>(false)
const videoUrl = computed(() => {
if (!isClick.value)
return undefined
if (props.bvid || props.aid)
return `https://www.bilibili.com/video/${props.bvid ?? `av${props.aid}`}`
else if (props.epid)
Expand Down Expand Up @@ -149,6 +154,17 @@ function handelMouseLeave() {
}, 300)
}
function switchClickState(flag: boolean) {
if (flag) {
isClick.value = flag
}
else {
setTimeout(() => {
isClick.value = flag
})
}
}
function handleMoreBtnClick(event: MouseEvent) {
emit('moreClick', event)
}
Expand Down Expand Up @@ -212,6 +228,9 @@ function handleUndo() {
:href="videoUrl" target="_blank" rel="noopener noreferrer"
@mouseenter="handleMouseEnter"
@mouseleave="handelMouseLeave"
@mousedown="switchClickState(true)"
@mouseup="switchClickState(false)"
@dragend="switchClickState(false)"
>
<!-- Cover -->
<div
Expand Down

0 comments on commit 1900387

Please sign in to comment.