王士厅

fix: 升级lottie三方库最新版本,修改沉浸式视频引导动画销毁逻辑

@@ -49,7 +49,8 @@ export struct LottieView { @@ -49,7 +49,8 @@ export struct LottieView {
49 onDestroyAnimation(){ 49 onDestroyAnimation(){
50 // 销毁动画,减少缓存 50 // 销毁动画,减少缓存
51 if (this.animateItem !== null) { 51 if (this.animateItem !== null) {
52 - this.animateItem.destroy(this.name); 52 + lottie.destroy(this.name)
  53 + // console.log('lottie', 'onDestroyAnimation')
53 this.animateItem = null; 54 this.animateItem = null;
54 } 55 }
55 56
@@ -68,6 +69,7 @@ export struct LottieView { @@ -68,6 +69,7 @@ export struct LottieView {
68 } 69 }
69 }) 70 })
70 .onDisAppear(()=>{ 71 .onDisAppear(()=>{
  72 + // console.log('lottie', 'onDisAppear')
71 this.onDestroyAnimation() 73 this.onDestroyAnimation()
72 }) 74 })
73 .onAppear(()=>{ 75 .onAppear(()=>{
@@ -420,18 +420,16 @@ export struct DetailVideoListPage { @@ -420,18 +420,16 @@ export struct DetailVideoListPage {
420 this.GestureLoadStrategy = 1 420 this.GestureLoadStrategy = 1
421 }) 421 })
422 // 手势动画 初次进入显示 422 // 手势动画 初次进入显示
423 - LottieView({  
424 - name: 'slider_up_view_more',  
425 - path: "lottie/slider_up_view_more.json",  
426 - lottieWidth: 167,  
427 - lottieHeight: 167,  
428 - autoplay: true,  
429 - loop: true  
430 - })  
431 - .visibility(this.GestureLoadStrategy == 0 ? Visibility.Visible : Visibility.Hidden)  
432 - .onTouch(() => {  
433 - this.GestureLoadStrategy = 1 423 + if(this.GestureLoadStrategy == 0) {
  424 + LottieView({
  425 + name: 'slider_up_view_more',
  426 + path: "lottie/slider_up_view_more.json",
  427 + lottieWidth: 167,
  428 + lottieHeight: 167,
  429 + autoplay: true,
  430 + loop: true
434 }) 431 })
  432 + }
435 } 433 }
436 } 434 }
437 .width('100%') 435 .width('100%')
@@ -16,7 +16,6 @@ import { window } from '@kit.ArkUI'; @@ -16,7 +16,6 @@ import { window } from '@kit.ArkUI';
16 import { EmptyComponent, WDViewDefaultType } from 'wdComponent/Index'; 16 import { EmptyComponent, WDViewDefaultType } from 'wdComponent/Index';
17 import { TrackConstants, TrackingPageBrowse } from 'wdTracking/Index'; 17 import { TrackConstants, TrackingPageBrowse } from 'wdTracking/Index';
18 import { LottieView } from 'wdComponent/Index' 18 import { LottieView } from 'wdComponent/Index'
19 -import lottie from '@ohos/lottie';  
20 19
21 interface loadMoreData { 20 interface loadMoreData {
22 pageNum: number; 21 pageNum: number;
@@ -349,20 +348,16 @@ export struct VideoChannelDetail { @@ -349,20 +348,16 @@ export struct VideoChannelDetail {
349 this.GestureLoadStrategy = 1 348 this.GestureLoadStrategy = 1
350 }) 349 })
351 // 手势动画 初次进入显示 350 // 手势动画 初次进入显示
352 - LottieView({  
353 - name: 'slider_up_view_more',  
354 - path: "lottie/slider_up_view_more.json",  
355 - lottieWidth: 167,  
356 - lottieHeight: 167,  
357 - autoplay: true,  
358 - loop: true  
359 - })  
360 - .visibility(this.isMouted && this.GestureLoadStrategy == 0 ? Visibility.Visible : Visibility.None)  
361 - .onTouch(() => {  
362 - this.GestureLoadStrategy = 1  
363 - lottie.destroy('slider_up_view_more') 351 + if(this.isMouted && this.GestureLoadStrategy == 0) {
  352 + LottieView({
  353 + name: 'slider_up_view_more',
  354 + path: "lottie/slider_up_view_more.json",
  355 + lottieWidth: 167,
  356 + lottieHeight: 167,
  357 + autoplay: true,
  358 + loop: true
364 }) 359 })
365 - 360 + }
366 } 361 }
367 } 362 }
368 .width('100%') 363 .width('100%')
@@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
11 "version": "1.0.0", 11 "version": "1.0.0",
12 "dependencies": { 12 "dependencies": {
13 "@ohos/pulltorefresh": "^2.0.6-rc.0", 13 "@ohos/pulltorefresh": "^2.0.6-rc.0",
14 - "@ohos/lottie": "v2.0.11-rc.6", 14 + "@ohos/lottie": "^v2.0.13",
15 "@ohos/imageknife": "^2.1.2", 15 "@ohos/imageknife": "^2.1.2",
16 }, 16 },
17 "dynamicDependencies": {} 17 "dynamicDependencies": {}