11<script setup lang="ts">
22import { computed , ref } from ' vue'
33
4- import { settings } from ' ~/logic'
54import { calcTimeSince , numFormatter } from ' ~/utils/dataFormatter'
65
76import type { Video } from ' ../types'
@@ -16,6 +15,7 @@ interface Props {
1615 videoUrl? : string
1716 moreBtn: boolean
1817 showVideoOptions: boolean
18+ titleFontSizeClass: string
1919 titleStyle: Record <string , string | number >
2020 authorFontSizeClass: string
2121 metaFontSizeClass: string
@@ -30,7 +30,6 @@ const emit = defineEmits<{
3030}>()
3131
3232const moreBtnRef = ref <HTMLDivElement | null >(null )
33- const titleRef = ref <HTMLElement | null >(null )
3433
3534defineExpose ({
3635 moreBtnRef ,
@@ -76,12 +75,12 @@ const primaryTags = computed(() => {
7675 text =" overflow-ellipsis $bew-text-1 lg"
7776 >
7877 <!-- 使用与真实文本相同的行高填充,考虑 line-height -->
79- <div w-full bg =" $bew-skeleton" rounded-4px class = " animate-pulse " style =" height : 1em ; margin-bottom : calc ((var (--bew-title-line-height , 1.35 ) - 1 ) * 0.5em );" />
80- <div w =" 3/4" bg =" $bew-skeleton" rounded-4px class = " animate-pulse " style =" height : 1em ;" />
78+ <div w-full bg =" $bew-skeleton" rounded-4px style =" height : 1em ; margin-bottom : calc ((var (--bew-title-line-height , 1.35 ) - 1 ) * 0.5em );" />
79+ <div w =" 3/4" bg =" $bew-skeleton" rounded-4px style =" height : 1em ;" />
8180 </div >
8281 <div
8382 v-if =" layout === 'modern'" shrink-0 w-8 h-8 rounded =" 1/2"
84- bg =" $bew-skeleton" class = " animate-pulse "
83+ bg =" $bew-skeleton"
8584 />
8685 </div >
8786
@@ -93,18 +92,17 @@ const primaryTags = computed(() => {
9392 >
9493 <div
9594 w =" 34px" h =" 34px" rounded =" 1/2" bg =" $bew-skeleton" shrink-0
96- class =" animate-pulse"
9795 />
9896 <div flex =" ~ col gap-1" w =" [calc(100%-50px)]" >
9997 <!-- 作者名称骨架:使用与真实文本相同的字体大小和行高 -->
10098 <div
101- w =" 60%" bg =" $bew-skeleton" rounded-4px class = " animate-pulse "
99+ w =" 60%" bg =" $bew-skeleton" rounded-4px
102100 :class =" authorFontSizeClass"
103101 style =" height : 1em ;"
104102 />
105103 <!-- 标签骨架:使用与真实标签相同的高度,包括 padding -->
106104 <div
107- w =" 80%" bg =" $bew-skeleton" rounded-4px class = " animate-pulse "
105+ w =" 80%" bg =" $bew-skeleton" rounded-4px
108106 :class =" metaFontSizeClass"
109107 style =" height : calc (1em + 0.24em );"
110108 />
@@ -118,7 +116,7 @@ const primaryTags = computed(() => {
118116 :class =" metaFontSizeClass"
119117 >
120118 <div
121- w =" 60px" bg =" $bew-skeleton" rounded =" $bew-radius" class = " animate-pulse "
119+ w =" 60px" bg =" $bew-skeleton" rounded =" $bew-radius"
122120 style =" height : calc (1em + 0.24em );"
123121 />
124122 </div >
@@ -133,7 +131,7 @@ const primaryTags = computed(() => {
133131 :class =" metaFontSizeClass"
134132 >
135133 <div
136- bg =" $bew-skeleton" rounded =" $bew-radius" class = " animate-pulse "
134+ bg =" $bew-skeleton" rounded =" $bew-radius"
137135 lh-6 p =" x-2" w =" 60px"
138136 style =" height : calc (1em + 0.24em );"
139137 />
@@ -153,9 +151,9 @@ const primaryTags = computed(() => {
153151 <div
154152 v-if =" horizontal"
155153 w =" 34px" h =" 34px" rounded =" 1/2" bg =" $bew-skeleton"
156- shrink-0 m-r-2 class = " animate-pulse "
154+ shrink-0 m-r-2
157155 />
158- <div w =" 100px" bg =" $bew-skeleton" rounded-4px class = " animate-pulse " style =" height : 1em ;" />
156+ <div w =" 100px" bg =" $bew-skeleton" rounded-4px style =" height : 1em ;" />
159157 </div >
160158
161159 <!-- View & Danmaku skeleton -->
@@ -164,7 +162,7 @@ const primaryTags = computed(() => {
164162 :class =" metaFontSizeClass"
165163 text =" $bew-text-2"
166164 >
167- <div w =" 150px" bg =" $bew-skeleton" rounded-4px class = " animate-pulse " style =" height : 1em ; display : inline-block ;" />
165+ <div w =" 150px" bg =" $bew-skeleton" rounded-4px style =" height : 1em ; display : inline-block ;" />
168166 </div >
169167 </div >
170168
@@ -175,7 +173,7 @@ const primaryTags = computed(() => {
175173 :class =" metaFontSizeClass"
176174 >
177175 <div
178- bg =" $bew-skeleton" rounded =" $bew-radius" class = " animate-pulse "
176+ bg =" $bew-skeleton" rounded =" $bew-radius"
179177 lh-6 p =" x-2" w =" 60px"
180178 style =" height : calc (1em + 0.24em );"
181179 />
@@ -197,13 +195,12 @@ const primaryTags = computed(() => {
197195 <div class =" group/desc" flex =" ~ col" :class =" layout === 'modern' ? 'gap-2' : ''" w =" full" align =" items-start" >
198196 <div flex =" ~ gap-1 justify-between items-start" w =" full" pos =" relative" >
199197 <h3
200- ref =" titleRef"
201198 :class =" [
202199 video.liveStatus === 1 ? 'keep-one-line' : 'keep-two-lines',
203- { 'bew-title-auto': settings.homeAdaptiveTitleAutoSize },
204200 layout === 'modern' ? 'video-card-title' : '',
201+ titleFontSizeClass,
205202 ]"
206- text =" overflow-ellipsis $bew-text-1 lg "
203+ text =" overflow-ellipsis $bew-text-1"
207204 :style =" titleStyle"
208205 cursor =" pointer"
209206 :title =" video.title"
@@ -497,13 +494,6 @@ const primaryTags = computed(() => {
497494</template >
498495
499496<style lang="scss" scoped>
500- .bew-title-auto {
501- /* Auto scale by actual card width (fallback to base grid width)
502- Increase responsiveness and use unitless line-height for better small-size rendering */
503- font-size : clamp (12px , calc ((var (--bew-card-width , var (--bew-home-card-min-width , 280px )) / 280 ) * 20px ), 30px );
504- line-height : clamp (1.15 , calc (1.1 + (var (--bew-card-width , var (--bew-home-card-min-width , 280px )) / 280 ) * 0.2 ), 1.5 );
505- }
506-
507497.video-card-title {
508498 & .keep-two-lines {
509499 min-height : calc (var (--bew-title-line-height , 1.35 ) * 2em );
0 commit comments