Showing
3 changed files
with
71 additions
and
0 deletions
| 1 | + | ||
| 2 | +@CustomDialog | ||
| 3 | + | ||
| 4 | +export struct DeleteCommentDialogView { | ||
| 5 | + functionData:FunctionsItem[] = [ | ||
| 6 | + new FunctionsItem('复制',$r('app.media.DeleteComment_copy')), | ||
| 7 | + new FunctionsItem('删除',$r('app.media.DeleteComment_delete')),] | ||
| 8 | + | ||
| 9 | + controller: CustomDialogController | ||
| 10 | + confirmCallback: (selectIndex:number) => void = () => { | ||
| 11 | + } | ||
| 12 | + build() { | ||
| 13 | + Column(){ | ||
| 14 | + Grid(){ | ||
| 15 | + ForEach(this.functionData,(dataItem:FunctionsItem,index:number)=>{ | ||
| 16 | + GridItem(){ | ||
| 17 | + this.girdItem(dataItem) | ||
| 18 | + }.onClick(()=> { | ||
| 19 | + this.controller.close() | ||
| 20 | + this.confirmCallback(index) | ||
| 21 | + }) | ||
| 22 | + .height(88) | ||
| 23 | + }) | ||
| 24 | + } | ||
| 25 | + .backgroundColor('#f8f8f8') | ||
| 26 | + .rowsTemplate('1fr') | ||
| 27 | + .columnsTemplate('1fr 1fr 1fr 1fr 1fr') | ||
| 28 | + .height(113) | ||
| 29 | + | ||
| 30 | + Divider() | ||
| 31 | + .color('#f5f5f5') | ||
| 32 | + .width('100%') | ||
| 33 | + .strokeWidth(5) | ||
| 34 | + Button('取消',{type:ButtonType.Normal}).height(60).width('100%').fontSize(14).fontColor('#222222').backgroundColor(0xffffff) | ||
| 35 | + .onClick(()=>{ | ||
| 36 | + this.controller.close() | ||
| 37 | + }) | ||
| 38 | + }.height(198).width('100%').backgroundColor(Color.White) | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + @Builder | ||
| 42 | + girdItem(item:FunctionsItem){ | ||
| 43 | + Column(){ | ||
| 44 | + Image(item.imgSrc) | ||
| 45 | + .objectFit(ImageFit.Auto) | ||
| 46 | + .interpolation(ImageInterpolation.High) | ||
| 47 | + .width(48) | ||
| 48 | + .height(48) | ||
| 49 | + | ||
| 50 | + Text(`${item.msg}`) | ||
| 51 | + .margin({top:8}) | ||
| 52 | + .lineHeight(12) | ||
| 53 | + .height(17) | ||
| 54 | + .fontColor($r('app.color.color_222222')) | ||
| 55 | + .fontSize(12) | ||
| 56 | + } | ||
| 57 | + .alignItems(HorizontalAlign.Center) | ||
| 58 | + .width('100%') | ||
| 59 | + | ||
| 60 | + } | ||
| 61 | +} | ||
| 62 | + | ||
| 63 | +class FunctionsItem { | ||
| 64 | + msg:string | ||
| 65 | + imgSrc:Resource | ||
| 66 | + | ||
| 67 | + constructor(msg:string,imgSrc:Resource){ | ||
| 68 | + this.msg = msg | ||
| 69 | + this.imgSrc = imgSrc | ||
| 70 | + } | ||
| 71 | +} |
5.44 KB
-
Please register or login to post a comment