You need to sign in or sign up before continuing.
未验证 提交 5fb3246c 编写于 作者: O openharmony_ci 提交者: Gitee

!20590 【web】新增onOverScroll接口

Merge pull request !20590 from zhufenghao/master
...@@ -3414,6 +3414,41 @@ onRequestSelected(callback: () => void) ...@@ -3414,6 +3414,41 @@ onRequestSelected(callback: () => void)
} }
``` ```
### onOverScroll<sup>10+</sup>
onOverScroll(callback: (event: {xOffset: number, yOffset: number}) => void)
通知网页过滚动偏移量。
**参数:**
| 参数名 | 参数类型 | 参数描述 |
| ------- | ------ | ------------ |
| xOffset | number | 以网页最左端为基准,水平过滚动偏移量。 |
| yOffset | number | 以网页最上端为基准,竖直过滚动偏移量。 |
**示例:**
```ts
// xxx.ets
import web_webview from '@ohos.web.webview'
@Entry
@Component
struct WebComponent {
controller: web_webview.WebviewController = new web_webview.WebviewController()
build() {
Column() {
Web({ src: 'www.example.com', controller: this.controller })
.onOverScroll((event) => {
console.info("x = " + event.xOffset)
console.info("y = " + event.yOffset)
})
}
}
}
```
## ConsoleMessage ## ConsoleMessage
Web组件获取控制台信息对象。示例代码参考[onConsole事件](#onconsole) Web组件获取控制台信息对象。示例代码参考[onConsole事件](#onconsole)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册