Showing
2 changed files
with
20 additions
and
1 deletions
| @@ -11,6 +11,7 @@ import font from '@ohos.font'; | @@ -11,6 +11,7 @@ import font from '@ohos.font'; | ||
| 11 | * 视频:点播图标+时长;直播图标+'直播中' | 11 | * 视频:点播图标+时长;直播图标+'直播中' |
| 12 | */ | 12 | */ |
| 13 | @Component | 13 | @Component |
| 14 | +@Reusable | ||
| 14 | export struct CardMediaInfo { | 15 | export struct CardMediaInfo { |
| 15 | 16 | ||
| 16 | @State livePeopleNum :boolean = true | 17 | @State livePeopleNum :boolean = true |
| @@ -33,6 +34,16 @@ export struct CardMediaInfo { | @@ -33,6 +34,16 @@ export struct CardMediaInfo { | ||
| 33 | }) | 34 | }) |
| 34 | } | 35 | } |
| 35 | 36 | ||
| 37 | + aboutToReuse(params: Record<string, object>): void { | ||
| 38 | + this.contentDTO = params.contentDTO as ContentDTO | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + aboutToRecycle(): void { | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + aboutToDisappear(): void { | ||
| 45 | + } | ||
| 46 | + | ||
| 36 | /** | 47 | /** |
| 37 | * 全域数字显示规则 | 48 | * 全域数字显示规则 |
| 38 | * 1、当数量为千位以內时,显示数字,不保留小数点,比如 4585 | 49 | * 1、当数量为千位以內时,显示数字,不保留小数点,比如 4585 |
| 1 | import { CompDTO, ContentDTO } from 'wdBean' | 1 | import { CompDTO, ContentDTO } from 'wdBean' |
| 2 | import { CommonConstants } from 'wdConstant/Index'; | 2 | import { CommonConstants } from 'wdConstant/Index'; |
| 3 | import { DateTimeUtils } from 'wdKit/Index'; | 3 | import { DateTimeUtils } from 'wdKit/Index'; |
| 4 | -import { JSON } from '@kit.ArkTS'; | ||
| 5 | import router from '@ohos.router' | 4 | import router from '@ohos.router' |
| 6 | 5 | ||
| 6 | +@Reusable | ||
| 7 | @Component | 7 | @Component |
| 8 | export struct CardSourceInfo { | 8 | export struct CardSourceInfo { |
| 9 | @State contentDTO: ContentDTO = new ContentDTO(); | 9 | @State contentDTO: ContentDTO = new ContentDTO(); |
| 10 | @ObjectLink compDTO: CompDTO | 10 | @ObjectLink compDTO: CompDTO |
| 11 | 11 | ||
| 12 | aboutToAppear(): void { | 12 | aboutToAppear(): void { |
| 13 | + } | ||
| 14 | + | ||
| 15 | + aboutToReuse(params: Record<string, object>): void { | ||
| 16 | + this.contentDTO = params.contentDTO as ContentDTO | ||
| 17 | + } | ||
| 13 | 18 | ||
| 19 | + aboutToRecycle(): void { | ||
| 14 | } | 20 | } |
| 15 | 21 | ||
| 22 | + aboutToDisappear(): void { | ||
| 23 | + } | ||
| 16 | handleTimeStr() { | 24 | handleTimeStr() { |
| 17 | return DateTimeUtils.getCommentTime( | 25 | return DateTimeUtils.getCommentTime( |
| 18 | this.contentDTO.publishTime.includes(' ') | 26 | this.contentDTO.publishTime.includes(' ') |
-
Please register or login to post a comment