@@ -126,6 +126,9 @@ const onLoad = () => {
126
126
imgLoaded .value = true ;
127
127
};
128
128
129
+ const transition = ref (false );
130
+ const timeout = ref ();
131
+
129
132
const getPosters = (_item : ListScrollItem ) => {
130
133
imgLoaded .value = false ;
131
134
if (_item .posterRef ?.value ) return ;
@@ -136,6 +139,10 @@ const getPosters = (_item: ListScrollItem) => {
136
139
query .type = ' show' ;
137
140
delete query .episode ;
138
141
}
142
+ setTimeout (() => {
143
+ if (resolvedPoster .value ) return ;
144
+ transition .value = true ;
145
+ }, 100 );
139
146
getImageUrl (query , 300 , _item .posterRef );
140
147
};
141
148
@@ -152,6 +159,7 @@ onMounted(() => {
152
159
});
153
160
154
161
onBeforeUnmount (() => {
162
+ clearTimeout (timeout .value );
155
163
if (! scrollIntoView .value ) return ;
156
164
emit (' onScrollOutOfView' , {
157
165
item: item ?.value ,
@@ -160,8 +168,6 @@ onBeforeUnmount(() => {
160
168
});
161
169
162
170
const itemHeight = computed (() => (height ?.value ? ` ${height .value }px ` : undefined ));
163
-
164
- const ListScrollItemTypeLocal = ListScrollItemType ;
165
171
</script >
166
172
167
173
<template >
@@ -222,7 +228,7 @@ const ListScrollItemTypeLocal = ListScrollItemType;
222
228
</template >
223
229
</NFlex >
224
230
225
- <slot v-if =" item.type === ListScrollItemTypeLocal .placeholder" >
231
+ <slot v-if =" item.type === ListScrollItemType .placeholder" >
226
232
<NFlex class =" placeholder" align =" center" justify =" center" :wrap =" false" >
227
233
<NEmpty size =" large" :description =" i18n('placeholder_empty')" />
228
234
</NFlex >
@@ -234,12 +240,14 @@ const ListScrollItemTypeLocal = ListScrollItemType;
234
240
:class =" {
235
241
episode,
236
242
loading: !imgLoaded,
243
+ transition,
237
244
}"
238
245
:object-fit =" objectFit"
239
246
width =" 100%"
240
247
lazy
241
248
preview-disabled
242
249
:src =" resolvedPoster"
250
+ :fallback-src =" PosterPlaceholder"
243
251
:on-load =" onLoad"
244
252
/>
245
253
<NImage
@@ -358,12 +366,18 @@ const ListScrollItemTypeLocal = ListScrollItemType;
358
366
width : var (--poster-width , 5.3125rem );
359
367
height : var (--poster-height , 8rem );
360
368
opacity : 1 ;
361
- transition : opacity 0.5s var (--n-bezier );
362
369
will-change : opacity ;
363
370
364
371
& .loading {
365
372
opacity : 0 ;
366
- transition : opacity 0.1s ;
373
+ }
374
+
375
+ & .transition {
376
+ transition : opacity 0.5s var (--n-bezier );
377
+
378
+ & .loading {
379
+ transition : opacity 0.1s ;
380
+ }
367
381
}
368
382
369
383
& .episode {
0 commit comments