mirror of
https://github.com/BewlyBewly/BewlyBewly.git
synced 2025-04-14 13:15:29 +00:00
fix(VideoCard): preview control cannot be dragged while pressing (#714)
* fix(VideoCard): preview control cannot be dragged while pressing * Update VideoCard.vue --------- Co-authored-by: Hakadao <a578457889743@gmail.com>
This commit is contained in:
@@ -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)
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user