1import router from '@ohos.router'; 2 3interface ListCategories { 4 title:string, 5 utl:string 6} 7 8@Entry 9@Component 10struct RotationIndex { 11 12 private items : ListCategories[] = [ 13 {title: 'Menu示例代码',utl: 'pages/Examples/Index' }, 14 {title: 'Menu生命周期',utl:'pages/LifeCycle/Index'}, 15 {title: 'Menu拖拽相关测试',utl:'pages/Drag/Index'}, 16 {title: 'bindContextMenu菜单UX规格',utl:'pages/BindContextMenu/Index'}, 17 {title: 'PreviewAnimation',utl:'pages/PreviewAnimation/Index'}, 18 {title: 'Dock',utl:'pages/Dock/Index'}, 19 ] 20 21 build() { 22 Column() { 23 Text('Menu测试用例') 24 .fontSize(22).fontColor(0xFFFFFF).fontWeight(FontWeight.Bold).textAlign(TextAlign.Center) 25 .width('100%').height(50).backgroundColor('#2ebd82') 26 List({space:'10vp'}) { 27 ForEach(this.items,(item : ListCategories) => { 28 ListItem() { 29 Text(item.title).fontSize(16).fontWeight(FontWeight.Bold) 30 }.width('90%').height('40vp').backgroundColor('#ff53ecd9').borderRadius(10) 31 .onClick(() => { 32 router.pushUrl({url:item.utl}) 33 }) 34 }) 35 }.alignListItem(ListItemAlign.Center).margin({top:'10vp'}).width('100%').height('80%') 36 }.width('100%').height('100%') 37 } 38}