未验证 提交 257cecae 编写于 作者: O openharmony_ci 提交者: Gitee

!20245 修改grid示例代码,适配onScrollBarUpdate

Merge pull request !20245 from huangdong/rm023bugfix1
...@@ -188,12 +188,11 @@ struct GridExample { ...@@ -188,12 +188,11 @@ struct GridExample {
console.info(first.toString()) console.info(first.toString())
}) })
.onScrollBarUpdate((index: number, offset: number) => { .onScrollBarUpdate((index: number, offset: number) => {
return {totalOffset: (index / 5) * (80 + 10) - 10 + offset, totalLength: 80 * 5 + 10 * 4} return {totalOffset: (index / 5) * (80 + 10) - 10 - offset, totalLength: 80 * 5 + 10 * 4}
}) })
.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 })
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册