|
@@ -1,26 +1,36 @@
|
|
|
<template>
|
|
<template>
|
|
|
- <div class="tag-box absolute color-white" :style="{ top: `${top}px`, left: `${left}px` }">
|
|
|
|
|
|
|
+ <div
|
|
|
|
|
+ :class="['tag-box' + index, 'absolute color-white']"
|
|
|
|
|
+ :style="{ top: `${top}px`, left: `${left}px` }"
|
|
|
|
|
+ >
|
|
|
<div
|
|
<div
|
|
|
- :class="[
|
|
|
|
|
- 'tag-count' + index,
|
|
|
|
|
- 'tag-box-wrapper p-1 w-144px absolute left-18px top--50px text-12px cursor-pointer'
|
|
|
|
|
- ]"
|
|
|
|
|
|
|
+ class="'tag-count tag-box-wrapper p-1 w-144px absolute left-18px top--50px text-12px cursor-pointer"
|
|
|
@click="toggle"
|
|
@click="toggle"
|
|
|
- ><div :class="['tag-label' + index, 'text-center']">{{ label }}</div></div
|
|
|
|
|
- >
|
|
|
|
|
- <div
|
|
|
|
|
- ref="floating"
|
|
|
|
|
- :class="[
|
|
|
|
|
- isShow ? 'transform-scale-100' : 'transform-scale-0',
|
|
|
|
|
- 'overflow-hidden origin-top-left transition pointer-events-none duration-300 z-999 h-200px w-300px bg-[rgba(11,21,44,1)] absolute left-165px top--50px b-solid b-1 b-#2BABF2'
|
|
|
|
|
- ]"
|
|
|
|
|
- >Tooltip</div
|
|
|
|
|
|
|
+ ><div class="tag-label text-center">{{ label }}</div></div
|
|
|
>
|
|
>
|
|
|
<img
|
|
<img
|
|
|
- :class="['tag-count' + index, 'absolute bottom-0 left-0 w-162px pointer-events-none']"
|
|
|
|
|
|
|
+ class="tag-count absolute bottom-0 left-0 w-162px pointer-events-none"
|
|
|
src="@/assets/images/tag2.png"
|
|
src="@/assets/images/tag2.png"
|
|
|
alt=""
|
|
alt=""
|
|
|
/>
|
|
/>
|
|
|
|
|
+ <Teleport defer to=".video-box-wrapper">
|
|
|
|
|
+ <div class="z-9 absolute" ref="floating" :style="{ top: top + 'px', left: left + 'px' }">
|
|
|
|
|
+ <transition name="scaleHide">
|
|
|
|
|
+ <div
|
|
|
|
|
+ v-if="isShow"
|
|
|
|
|
+ class="overflow-hidden origin-top-left h-200px w-300px bg-[rgba(11,21,44,1)] absolute left-10px top--0px b-solid b-1 b-#2BABF2"
|
|
|
|
|
+ >
|
|
|
|
|
+ <div class="flex justify-between p-1">
|
|
|
|
|
+ <span>{{ label }}</span>
|
|
|
|
|
+ <span
|
|
|
|
|
+ class="i-material-symbols-close text-coolgray cursor-pointer"
|
|
|
|
|
+ @click.stop="isShow = false"
|
|
|
|
|
+ ></span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </transition>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </Teleport>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
@@ -52,51 +62,28 @@
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const init = () => {
|
|
const init = () => {
|
|
|
- const tagCount = document.querySelectorAll('.tag-count' + props.index)
|
|
|
|
|
|
|
+ const tagBox = document.querySelector('.tag-box' + props.index)
|
|
|
|
|
+ const tagLabel = tagBox.querySelector('.tag-label')
|
|
|
const videoCount = document.querySelector('.pub-video')
|
|
const videoCount = document.querySelector('.pub-video')
|
|
|
- const t1 = tagCount[0].getBoundingClientRect()
|
|
|
|
|
- const t2 = tagCount[1].getBoundingClientRect()
|
|
|
|
|
- const tagBoxH = t1.height + t2.height
|
|
|
|
|
- const tagBoxW = t1.width + t2.width
|
|
|
|
|
- if (tagBoxH > props.top) {
|
|
|
|
|
- tagCount[0].style.top = `23px`
|
|
|
|
|
- tagCount[1].style.transform = 'rotateX(180deg)'
|
|
|
|
|
- tagCount[1].style.bottom = 'auto'
|
|
|
|
|
- floating.value.style.top = '18px'
|
|
|
|
|
- } else {
|
|
|
|
|
- tagCount[0].style.top = `-50px`
|
|
|
|
|
- tagCount[1].style.transform = 'rotateX(0)'
|
|
|
|
|
- tagCount[1].style.bottom = '0'
|
|
|
|
|
- floating.value.style.top = '-50px'
|
|
|
|
|
- }
|
|
|
|
|
- if (tagBoxW + props.left > videoCount.offsetWidth) {
|
|
|
|
|
- tagCount[0].style.right = '18px'
|
|
|
|
|
- tagCount[1].style.right = '0'
|
|
|
|
|
- tagCount[0].style.left = 'auto'
|
|
|
|
|
- tagCount[1].style.left = 'auto'
|
|
|
|
|
- tagCount[0].style.transform = 'rotateY(180deg)'
|
|
|
|
|
- tagCount[1].style.transform = 'rotateY(180deg)'
|
|
|
|
|
- document.querySelector('.tag-label' + props.index).style.transform = 'rotateY(180deg)'
|
|
|
|
|
- floating.value.style.left = 'auto'
|
|
|
|
|
- floating.value.style.right = '165px'
|
|
|
|
|
- floating.value.style.transformOrigin = 'top right'
|
|
|
|
|
- } else {
|
|
|
|
|
- tagCount[0].style.right = 'auto'
|
|
|
|
|
- tagCount[1].style.right = 'auto'
|
|
|
|
|
- tagCount[0].style.left = '18px'
|
|
|
|
|
- tagCount[1].style.left = '0'
|
|
|
|
|
- tagCount[0].style.transform = 'rotateY(0)'
|
|
|
|
|
- tagCount[1].style.transform = 'rotate(180deg,0)'
|
|
|
|
|
- document.querySelector('.tag-label' + props.index).style.transform = 'rotateY(0)'
|
|
|
|
|
- floating.value.style.left = '165px'
|
|
|
|
|
- floating.value.style.right = 'auto'
|
|
|
|
|
- floating.value.style.transformOrigin = 'top left'
|
|
|
|
|
|
|
+ const { width, height } = videoCount.getBoundingClientRect()
|
|
|
|
|
+ const [w, h] = [width / 2, height / 2]
|
|
|
|
|
+
|
|
|
|
|
+ if (props.left > w) {
|
|
|
|
|
+ tagBox.style.transform = 'rotateY(180deg)'
|
|
|
|
|
+ tagLabel.style.transform = 'rotateY(180deg)'
|
|
|
|
|
+ if (props.top < h) {
|
|
|
|
|
+ tagBox.style.transform = 'rotate(180deg)'
|
|
|
|
|
+ tagLabel.style.transform = 'rotate(180deg)'
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if (props.top < h) {
|
|
|
|
|
+ tagBox.style.transform = 'rotateX(180deg)'
|
|
|
|
|
+ tagLabel.style.transform = 'rotateX(180deg)'
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
- setTimeout(() => {
|
|
|
|
|
|
|
+ nextTick(() => {
|
|
|
init()
|
|
init()
|
|
|
- }, 100)
|
|
|
|
|
|
|
+ })
|
|
|
})
|
|
})
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
@@ -105,4 +92,19 @@
|
|
|
background: url('@/assets/images/tag1.png') no-repeat;
|
|
background: url('@/assets/images/tag1.png') no-repeat;
|
|
|
background-size: 100% 100%;
|
|
background-size: 100% 100%;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ .scaleHide-enter-active {
|
|
|
|
|
+ animation: bounce-in 0.5s;
|
|
|
|
|
+ }
|
|
|
|
|
+ .scaleHide-leave-active {
|
|
|
|
|
+ animation: bounce-in 0.5s reverse;
|
|
|
|
|
+ }
|
|
|
|
|
+ @keyframes bounce-in {
|
|
|
|
|
+ 0% {
|
|
|
|
|
+ transform: scale(0);
|
|
|
|
|
+ }
|
|
|
|
|
+ 100% {
|
|
|
|
|
+ transform: scale(1);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
</style>
|
|
</style>
|