Showing
2 changed files
with
15 additions
and
11 deletions
| @@ -17,7 +17,7 @@ export default struct MinePagePersonFunctionUI { | @@ -17,7 +17,7 @@ export default struct MinePagePersonFunctionUI { | ||
| 17 | Grid(){ | 17 | Grid(){ |
| 18 | ForEach(this.personalData,(item:MinePagePersonalFunctionsItem,index:number)=>{ | 18 | ForEach(this.personalData,(item:MinePagePersonalFunctionsItem,index:number)=>{ |
| 19 | GridItem(){ | 19 | GridItem(){ |
| 20 | - PagePersonFunction({ item: item, noDivider : (index % 5 < 4 && index != this.personalData.length-1) ? false : true}) | 20 | + PagePersonFunction({ item: item, noDivider : (index % 5 < 4 && index != this.personalData.length-1) ? false : true,percent:$percent}) |
| 21 | }.onClick(()=>{ | 21 | }.onClick(()=>{ |
| 22 | console.log(index+"") | 22 | console.log(index+"") |
| 23 | switch (item.msg){ | 23 | switch (item.msg){ |
| @@ -78,7 +78,7 @@ export default struct MinePagePersonFunctionUI { | @@ -78,7 +78,7 @@ export default struct MinePagePersonFunctionUI { | ||
| 78 | break; | 78 | break; |
| 79 | } | 79 | } |
| 80 | } | 80 | } |
| 81 | - }).width(`${this.calcHeight(142)}lpx`) | 81 | + })/*.width(`${this.calcHeight(142)}lpx`)*/ |
| 82 | .height(`${this.calcHeight(117)}lpx`) | 82 | .height(`${this.calcHeight(117)}lpx`) |
| 83 | }) | 83 | }) |
| 84 | } | 84 | } |
| @@ -4,6 +4,7 @@ import MinePagePersonalFunctionsItem from '../../viewmodel/MinePagePersonalFunct | @@ -4,6 +4,7 @@ import MinePagePersonalFunctionsItem from '../../viewmodel/MinePagePersonalFunct | ||
| 4 | export struct PagePersonFunction{ | 4 | export struct PagePersonFunction{ |
| 5 | @ObjectLink item: MinePagePersonalFunctionsItem | 5 | @ObjectLink item: MinePagePersonalFunctionsItem |
| 6 | @State noDivider:boolean = false | 6 | @State noDivider:boolean = false |
| 7 | + @Link percent:number | ||
| 7 | 8 | ||
| 8 | build() { | 9 | build() { |
| 9 | Row(){ | 10 | Row(){ |
| @@ -15,18 +16,18 @@ export struct PagePersonFunction{ | @@ -15,18 +16,18 @@ export struct PagePersonFunction{ | ||
| 15 | if (this.item.isShowRedPoint) { | 16 | if (this.item.isShowRedPoint) { |
| 16 | Button() | 17 | Button() |
| 17 | .type(ButtonType.Circle) | 18 | .type(ButtonType.Circle) |
| 18 | - .width("12lpx") | ||
| 19 | - .height("12lpx") | 19 | + .width(`${this.calcHeight(12)}lpx`) |
| 20 | + .height(`${this.calcHeight(12)}lpx`) | ||
| 20 | .backgroundColor($r('app.color.color_ED2800')) | 21 | .backgroundColor($r('app.color.color_ED2800')) |
| 21 | } | 22 | } |
| 22 | - }.width('46lpx') | ||
| 23 | - .height('46lpx') | 23 | + }.width(`${this.calcHeight(46)}lpx`) |
| 24 | + .height(`${this.calcHeight(46)}lpx`) | ||
| 24 | 25 | ||
| 25 | Text(`${this.item.msg}`) | 26 | Text(`${this.item.msg}`) |
| 26 | - .margin({top:'8lpx'}) | ||
| 27 | - .height('23lpx') | 27 | + .margin({top:`${this.calcHeight(8)}lpx`}) |
| 28 | + .height(`${this.calcHeight(23)}lpx`) | ||
| 28 | .fontColor($r('app.color.color_222222')) | 29 | .fontColor($r('app.color.color_222222')) |
| 29 | - .fontSize('23lpx') | 30 | + .fontSize(`${this.calcHeight(23)}lpx`) |
| 30 | } | 31 | } |
| 31 | .alignItems(HorizontalAlign.Center) | 32 | .alignItems(HorizontalAlign.Center) |
| 32 | .width('100%') | 33 | .width('100%') |
| @@ -35,10 +36,13 @@ export struct PagePersonFunction{ | @@ -35,10 +36,13 @@ export struct PagePersonFunction{ | ||
| 35 | if(!this.noDivider){ | 36 | if(!this.noDivider){ |
| 36 | Text().backgroundColor($r('app.color.color_222222')) | 37 | Text().backgroundColor($r('app.color.color_222222')) |
| 37 | .opacity(0.1) | 38 | .opacity(0.1) |
| 38 | - .width('2lpx') | ||
| 39 | - .height('29lpx') | 39 | + .width(`${this.calcHeight(2)}lpx`) |
| 40 | + .height(`${this.calcHeight(29)}lpx`) | ||
| 40 | } | 41 | } |
| 41 | } | 42 | } |
| 42 | } | 43 | } |
| 43 | 44 | ||
| 45 | + calcHeight(value:number): number{ | ||
| 46 | + return value * this.percent | ||
| 47 | + } | ||
| 44 | } | 48 | } |
-
Please register or login to post a comment