提交 319beabd 编写于 作者: Y yeyinglong

ListItemGroup示例代码修改

Signed-off-by: Nyeyinglong <yeyinglong@live.com>
上级 1726eaec
...@@ -38,28 +38,6 @@ ListItemGroup(options?: {header?: CustomBuilder, footer?: CustomBuilder, space?: ...@@ -38,28 +38,6 @@ ListItemGroup(options?: {header?: CustomBuilder, footer?: CustomBuilder, space?:
```ts ```ts
// xxx.ets // xxx.ets
function itemHeadBuilder(text: string) {
@Builder function itemHead() {
Text(text)
.fontSize(20)
.backgroundColor(0xAABBCC)
.width("100%")
.padding(10)
}
return itemHead
}
function itemFootBuilder(num: number) {
@Builder function itemFoot() {
Text('' + num + "节课")
.fontSize(16)
.backgroundColor(0xAABBCC)
.width("100%")
.padding(5)
}
return itemFoot
}
@Entry @Entry
@Component @Component
struct ListItemGroupExample { struct ListItemGroupExample {
...@@ -82,11 +60,27 @@ struct ListItemGroupExample { ...@@ -82,11 +60,27 @@ struct ListItemGroupExample {
} }
] ]
@Builder itemHead(text:string) {
Text(text)
.fontSize(20)
.backgroundColor(0xAABBCC)
.width("100%")
.padding(10)
}
@Builder itemFoot(num:number) {
Text('' + num + "节课")
.fontSize(16)
.backgroundColor(0xAABBCC)
.width("100%")
.padding(5)
}
build() { build() {
Column() { Column() {
List({ space: 20 }) { List({ space: 20 }) {
ForEach(this.timetable, (item) => { ForEach(this.timetable, (item) => {
ListItemGroup({ header:itemHeadBuilder(item.title), footer:itemFootBuilder(item.projects.length) }) { ListItemGroup({ header:this.itemHead(item.title), footer:this.itemFoot(item.projects.length) }) {
ForEach(item.projects, (project) => { ForEach(item.projects, (project) => {
ListItem() { ListItem() {
Text(project) Text(project)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册