From 75f19173e94c5c82d6e6a273222fb2d97d7eee1e Mon Sep 17 00:00:00 2001 From: wangjing247 Date: Mon, 3 Apr 2023 16:05:26 +0800 Subject: [PATCH] =?UTF-8?q?[webview=E9=83=A8=E4=BB=B6]web=20DFX=E8=83=BD?= =?UTF-8?q?=E5=8A=9B=20=E6=94=AF=E6=8C=81web=E9=A6=96=E5=B1=8F=E6=A3=80?= =?UTF-8?q?=E6=B5=8B=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangjing247 --- .../arkui-ts/ts-basic-components-web.md | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md index a378124234..194910c3d3 100755 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md @@ -3099,6 +3099,43 @@ onAudioStateChanged(callback: (event: { playing: boolean }) => void) } ``` +### onFirstContentfulPaint10+ + +onFirstContentfulPaint(callback: (event?: { navigationStartTick: number, + firstContentfulPaintMs: number }) => void) + +设置网页首次内容绘制回调函数。 + +**参数:** + +| 参数名 | 参数类型 | 参数描述 | +| -----------------------| -------- | ----------------------------------- | +| navigationStartTick | number | navigation开始的时间,单位以微秒表示 | +| firstContentfulPaintMs | number | 从navigation开始第一次绘制内容的时间。单位是以毫秒表示 | + +**示例:** + + ```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 }) + .onFirstContentfulPaint(event => { + console.log("onFirstContentfulPaint:" + "[navigationStartTick]:" + + event.navigationStartTick + ", [firstContentfulPaintMs]:" + + event.firstContentfulPaintMs) + }) + } + } + } + ``` + ### onLoadIntercept10+ onLoadIntercept(callback: (event?: { data: WebResourceRequest }) => boolean) -- GitLab