未验证 提交 3588dec6 编写于 作者: O openharmony_ci 提交者: Gitee

!19850 List Grid文档代码修改

Merge pull request !19850 from yeyinglong/scroll
...@@ -200,6 +200,7 @@ struct GridExample { ...@@ -200,6 +200,7 @@ struct GridExample {
.width('90%') .width('90%')
.backgroundColor(0xFAEEE0) .backgroundColor(0xFAEEE0)
.height(300) .height(300)
.scrollBar(BarState.Off)
Button('next page') Button('next page')
.onClick(() => { // 点击后滑到下一页 .onClick(() => { // 点击后滑到下一页
this.scroller.scrollPage({ next: true }) this.scroller.scrollPage({ next: true })
......
...@@ -41,8 +41,8 @@ List(value?:{space?: number | string, initialIndex?: number, scroller? ...@@ -41,8 +41,8 @@ List(value?:{space?: number | string, initialIndex?: number, scroller?
| 参数名 | 参数类型 | 必填 | 参数描述 | | 参数名 | 参数类型 | 必填 | 参数描述 |
| ------------ | ---------------------------------------- | ---- | ---------------------------------------- | | ------------ | ---------------------------------------- | ---- | ---------------------------------------- |
| space | number&nbsp;\|&nbsp;string | 否 | 子组件主轴方向的间隔。<br/>默认值:0<br/>**说明:** <br/>设置为除-1外其他负数或百分比时,按默认值显示。<br/>space参数值小于List分割线宽度时,子组件主轴方向的间隔取分割线宽度。 | | space | number&nbsp;\|&nbsp;string | 否 | 子组件主轴方向的间隔。<br/>默认值:0<br/>**说明:** <br/>设置为负数时,按默认值显示。<br/>space参数值小于List分割线宽度时,子组件主轴方向的间隔取分割线宽度。 |
| initialIndex | number | 否 | 设置当前List初次加载时视口起始位置显示的item的索引值。<br/>默认值:0<br/>**说明:** <br/>设置为除-1外其他负数或超过了当前List最后一个item的索引值时视为无效取值,无效取值按默认值显示。 | | initialIndex | number | 否 | 设置当前List初次加载时视口起始位置显示的item的索引值。<br/>默认值:0<br/>**说明:** <br/>设置为负数或超过了当前List最后一个item的索引值时视为无效取值,无效取值按默认值显示。 |
| scroller | [Scroller](ts-container-scroll.md#scroller) | 否 | 可滚动组件的控制器。用于与可滚动组件进行绑定。<br/>**说明:** <br/>不允许和其他滚动类组件绑定同一个滚动控制对象。 | | scroller | [Scroller](ts-container-scroll.md#scroller) | 否 | 可滚动组件的控制器。用于与可滚动组件进行绑定。<br/>**说明:** <br/>不允许和其他滚动类组件绑定同一个滚动控制对象。 |
## 属性 ## 属性
...@@ -181,6 +181,7 @@ struct ListExample { ...@@ -181,6 +181,7 @@ struct ListExample {
}, item => item) }, item => item)
} }
.listDirection(Axis.Vertical) // 排列方向 .listDirection(Axis.Vertical) // 排列方向
.scrollBar(BarState.Off)
.divider({ strokeWidth: 2, color: 0xFFFFFF, startMargin: 20, endMargin: 20 }) // 每行之间的分界线 .divider({ strokeWidth: 2, color: 0xFFFFFF, startMargin: 20, endMargin: 20 }) // 每行之间的分界线
.edgeEffect(EdgeEffect.Spring) // 滑动到边缘无效果 .edgeEffect(EdgeEffect.Spring) // 滑动到边缘无效果
.onScrollIndex((firstIndex: number, lastIndex: number) => { .onScrollIndex((firstIndex: number, lastIndex: number) => {
...@@ -231,6 +232,7 @@ struct ListLanesExample { ...@@ -231,6 +232,7 @@ struct ListLanesExample {
.border({ width: 3, color: Color.Red }) .border({ width: 3, color: Color.Red })
.lanes({ minLength: 40, maxLength: 40 }) .lanes({ minLength: 40, maxLength: 40 })
.alignListItem(this.alignListItem) .alignListItem(this.alignListItem)
.scrollBar(BarState.Off)
Button("点击更改alignListItem:" + this.alignListItem).onClick(() => { Button("点击更改alignListItem:" + this.alignListItem).onClick(() => {
if (this.alignListItem == ListItemAlign.Start) { if (this.alignListItem == ListItemAlign.Start) {
...@@ -289,6 +291,7 @@ struct ListExample{ ...@@ -289,6 +291,7 @@ struct ListExample{
} }
}, item => item) }, item => item)
}.width('90%') }.width('90%')
.scrollBar(BarState.Off)
}.width('100%') }.width('100%')
Button('edit list') Button('edit list')
......
...@@ -118,6 +118,7 @@ struct ListItemExample { ...@@ -118,6 +118,7 @@ struct ListItemExample {
} }
}, item => item) }, item => item)
}.width('90%') }.width('90%')
.scrollBar(BarState.Off)
}.width('100%').height('100%').backgroundColor(0xDCDCDC).padding({ top: 5 }) }.width('100%').height('100%').backgroundColor(0xDCDCDC).padding({ top: 5 })
} }
} }
...@@ -125,54 +126,6 @@ struct ListItemExample { ...@@ -125,54 +126,6 @@ struct ListItemExample {
![zh-cn_image_0000001219864159](figures/zh-cn_image_0000001219864159.gif) ![zh-cn_image_0000001219864159](figures/zh-cn_image_0000001219864159.gif)
```ts
// xxx.ets
@Entry
@Component
struct ListItemExample2 {
@State message: string = 'Hello World'
@Builder itemEnd() {
Row () {
Button("Del").margin("4vp")
Button("Set").margin("4vp")
}.padding("4vp").justifyContent(FlexAlign.SpaceEvenly)
}
build() {
Column() {
List({space:10}) {
ListItem() {
Text(this.message)
.width('100%')
.height(100)
.fontSize(16)
.textAlign(TextAlign.Center)
.borderRadius(10)
.backgroundColor(0xFFFFFF)
}
.swipeAction({ end:this.itemEnd})
ListItem() {
Text(this.message)
.width('100%')
.height(100)
.fontSize(16)
.textAlign(TextAlign.Center)
.borderRadius(10)
.backgroundColor(0xFFFFFF)
}
.swipeAction({ start:this.itemEnd})
}
}
.padding(10)
.backgroundColor(0xDCDCDC)
.width('100%')
.height('100%')
}
}
```
![zh-cn_image_1501929990650](figures/zh-cn_image_1501929990650.jpg)
```ts ```ts
// xxx.ets // xxx.ets
......
...@@ -107,12 +107,12 @@ struct ListItemGroupExample { ...@@ -107,12 +107,12 @@ struct ListItemGroupExample {
} }
}, item => item) }, item => item)
} }
.borderRadius(20)
.divider({ strokeWidth: 1, color: Color.Blue }) // 每行之间的分界线 .divider({ strokeWidth: 1, color: Color.Blue }) // 每行之间的分界线
}) })
} }
.width('90%') .width('90%')
.sticky(StickyStyle.Header|StickyStyle.Footer) .sticky(StickyStyle.Header|StickyStyle.Footer)
.scrollBar(BarState.Off)
}.width('100%').height('100%').backgroundColor(0xDCDCDC).padding({ top: 5 }) }.width('100%').height('100%').backgroundColor(0xDCDCDC).padding({ top: 5 })
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册