Showing
1 changed file
with
24 additions
and
1 deletions
| @@ -17,12 +17,26 @@ export struct Card6Component { | @@ -17,12 +17,26 @@ export struct Card6Component { | ||
| 17 | @State contentDTO: ContentDTO = new ContentDTO(); | 17 | @State contentDTO: ContentDTO = new ContentDTO(); |
| 18 | @State loadImg: boolean = false; | 18 | @State loadImg: boolean = false; |
| 19 | @State clicked: boolean = false; | 19 | @State clicked: boolean = false; |
| 20 | + @State titleMarked: boolean = false; | ||
| 21 | + @State str01: string = ''; | ||
| 22 | + @State str02: string = ''; | ||
| 23 | + @State str03: string = ''; | ||
| 20 | 24 | ||
| 21 | async aboutToAppear(): Promise<void> { | 25 | async aboutToAppear(): Promise<void> { |
| 26 | + this.titleInit(); | ||
| 22 | this.loadImg = await onlyWifiLoadImg(); | 27 | this.loadImg = await onlyWifiLoadImg(); |
| 23 | // this.clicked = hasClicked(this.contentDTO.objectId) | 28 | // this.clicked = hasClicked(this.contentDTO.objectId) |
| 24 | } | 29 | } |
| 25 | 30 | ||
| 31 | + titleInit() { | ||
| 32 | + if (this.contentDTO.title.includes('<em>') && this.contentDTO.title.includes('</em>')) { | ||
| 33 | + this.titleMarked = true; | ||
| 34 | + this.str01 = this.contentDTO.newsTitle?.split('<em>')[0] || ''; | ||
| 35 | + this.str02 = this.contentDTO.newsTitle?.split('<em>')[1].split('</em>')[0] || ''; | ||
| 36 | + this.str03 = this.contentDTO.newsTitle?.split('<em>')[1].split('</em>')[1] || ''; | ||
| 37 | + } | ||
| 38 | + } | ||
| 39 | + | ||
| 26 | build() { | 40 | build() { |
| 27 | Row() { | 41 | Row() { |
| 28 | Column() { | 42 | Column() { |
| @@ -44,7 +58,16 @@ export struct Card6Component { | @@ -44,7 +58,16 @@ export struct Card6Component { | ||
| 44 | Notes({ objectType: this.contentDTO.objectType }) | 58 | Notes({ objectType: this.contentDTO.objectType }) |
| 45 | } | 59 | } |
| 46 | 60 | ||
| 47 | - Text(`${this.contentDTO.newsTitle}`) | 61 | + Text() { |
| 62 | + if (this.titleMarked) { | ||
| 63 | + Span(this.str01) | ||
| 64 | + Span(this.str02) | ||
| 65 | + .fontColor(0xED2800) | ||
| 66 | + Span(this.str03) | ||
| 67 | + } else { | ||
| 68 | + Span(this.contentDTO.newsTitle) | ||
| 69 | + } | ||
| 70 | + } | ||
| 48 | .fontColor(this.clicked ? 0x848484 : 0x222222) | 71 | .fontColor(this.clicked ? 0x848484 : 0x222222) |
| 49 | .fontSize(16) | 72 | .fontSize(16) |
| 50 | .lineHeight(24) | 73 | .lineHeight(24) |
-
Please register or login to post a comment