diff --git a/zh-cn/application-dev/reference/apis/js-apis-webview.md b/zh-cn/application-dev/reference/apis/js-apis-webview.md index 810b6e98e7fb9ecffa8cc43f3a640e71ec95d9a8..e1fb29b835a0c786fc6bbe3d40234d0f1366ec2d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-webview.md +++ b/zh-cn/application-dev/reference/apis/js-apis-webview.md @@ -1826,7 +1826,7 @@ struct WebComponent { getTitle(): string -获取文件选择器标题。 +获取当前网页的标题。 **系统能力:** SystemCapability.Web.Webview.Core @@ -1834,7 +1834,7 @@ getTitle(): string | 类型 | 说明 | | ------ | -------------------- | -| string | 返回文件选择器标题。 | +| string | 当前网页的标题。 | **错误码:** @@ -2527,7 +2527,6 @@ setNetworkAvailable(enable: boolean): void | 错误码ID | 错误信息 | | -------- | ------------------------------------------------------------ | | 17100001 | Init error. The WebviewController must be associated with a Web component. | -| 401 | Invalid input parameter. | **示例:** @@ -2558,7 +2557,7 @@ struct WebComponent { ### hasImage -hasImage(callback: AsyncCallback): void +hasImage(callback: AsyncCallback\): void 通过Callback方式异步查找当前页面是否存在图像。 @@ -2577,7 +2576,6 @@ hasImage(callback: AsyncCallback): void | 错误码ID | 错误信息 | | -------- | ------------------------------------------------------------ | | 17100001 | Init error. The WebviewController must be associated with a Web compoent. | -| 401 | Invalid input parameter. | **示例:** @@ -2595,7 +2593,7 @@ struct WebComponent { Button('hasImageCb') .onClick(() => { try { - this.controller.hasImage((err, data) => { + this.controller.hasImage((error, data) => { if (error) { console.info(`hasImage error: ` + JSON.stringify(error)) return; @@ -2614,7 +2612,7 @@ struct WebComponent { ### hasImage -hasImage(): Promise +hasImage(): Promise\ 通过Promise方式异步查找当前页面是否存在图像。 @@ -2633,7 +2631,6 @@ hasImage(): Promise | 错误码ID | 错误信息 | | -------- | ------------------------------------------------------------ | | 17100001 | Init error. The WebviewController must be associated with a Web compoent. | -| 401 | Invalid input parameter. | **示例:** @@ -2679,7 +2676,7 @@ removeCache(clearRom: boolean): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ------- | ---- | -------------------------------------------------------- | -| clearRom | boolean | 是 | 是否同时清除rom和ram中的缓存,false时只清除ram中的缓存。 | +| clearRom | boolean | 是 | 设置为true时同时清除rom和ram中的缓存,设置为false时只清除ram中的缓存。 | **错误码:** @@ -2688,7 +2685,6 @@ removeCache(clearRom: boolean): void | 错误码ID | 错误信息 | | -------- | ------------------------------------------------------------ | | 17100001 | Init error. The WebviewController must be associated with a Web component. | -| 401 | Invalid input parameter. | **示例:** @@ -3932,7 +3928,7 @@ struct WebComponent { @Component struct WebComponent { controller: WebController = new WebController(); - webAsyncController: WebAsyncController = new web_webview.WebAsyncController(this.controller) + webAsyncController: web_webview.WebAsyncController = new web_webview.WebAsyncController(this.controller) build() { Column() { Web({ src: 'www.example.com', controller: this.controller }) @@ -4452,7 +4448,7 @@ Web组件返回的请求/响应头对象。 | 名称 | 类型 | 可读 | 可写 | 说明 | | ------------ | ------ | ---- | ---- | ---------------------------- | -| currentIndex | number | 是 | 否 | 当前在页面历史列表中的索引。 | +| currentIndex | number | 是 | 否 | 当前页面在页面历史列表中的索引。 | | size | number | 是 | 否 | 历史列表中索引的数量。 | ### getItemAtIndex @@ -4475,14 +4471,6 @@ getItemAtIndex(index: number): HistoryItem | --------------------------- | ------------ | | [HistoryItem](#historyitem) | 历史记录项。 | -**错误码:** - -以下错误码的详细介绍请参见 [webview错误码](../errorcodes/errorcode-webview.md) - -| 错误码ID | 错误信息 | -| -------- | ----------------------- | -| 401 | Invalid input parameter | - **示例:** ```ts @@ -4504,7 +4492,7 @@ struct WebComponent { let list = this.controller.getBackForwardEntries(); let historyItem = list.getItemAtIndex(list.currentIndex); console.log("HistoryItem: " + JSON.stringify(historyItem)); - this.icon = item.icon; + this.icon = historyItem.icon; } catch (error) { console.error(`ErrorCode: ${error.code}, Message: ${error.message}`); } @@ -4539,5 +4527,3 @@ struct WebComponent { | schemeName | string | 是 | 是 | 自定义协议名称。最大长度为32,其字符仅支持小写字母、数字、'.'、'+'、'-'。 | | isSupportCORS | boolean | 是 | 是 | 是否支持跨域请求。 | | isSupportFetch | boolean | 是 | 是 | 是否支持fetch请求。 | - -### 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 474217f8666c877f11d13ec3a318cef24215ca15..eb99d96c45b06369150673cd442cf5bd1d61d746 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 @@ -467,13 +467,13 @@ geolocationAccess(geolocationAccess: boolean) mediaPlayGestureAccess(access: boolean) -设置视频播放是否需要用户手动点击。 +设置有声视频播放是否需要用户手动点击,静音视频播放不受该接口管控。 **参数:** | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | | ------ | ------- | ---- | ---- | ----------------- | -| access | boolean | 是 | true | 设置视频播放是否需要用户手动点击。 | +| access | boolean | 是 | true | 设置有声视频播放是否需要用户手动点击。 | **示例:** @@ -827,11 +827,11 @@ defaultFixedFontSize(size: number) @Component struct WebComponent { controller: web_webview.WebviewController = new web_webview.WebviewController() - @State size: number = 16 + @State fontSize: number = 16 build() { Column() { Web({ src: 'www.example.com', controller: this.controller }) - .defaultFixedFontSize(this.size) + .defaultFixedFontSize(this.fontSize) } } } @@ -858,11 +858,11 @@ defaultFontSize(size: number) @Component struct WebComponent { controller: web_webview.WebviewController = new web_webview.WebviewController() - @State size: number = 13 + @State fontSize: number = 13 build() { Column() { Web({ src: 'www.example.com', controller: this.controller }) - .defaultFontSize(this.size) + .defaultFontSize(this.fontSize) } } } @@ -889,11 +889,11 @@ minFontSize(size: number) @Component struct WebComponent { controller: web_webview.WebviewController = new web_webview.WebviewController() - @State size: number = 13 + @State fontSize: number = 13 build() { Column() { Web({ src: 'www.example.com', controller: this.controller }) - .minFontSize(this.size) + .minFontSize(this.fontSize) } } } @@ -920,11 +920,11 @@ minLogicalFontSize(size: number) @Component struct WebComponent { controller: web_webview.WebviewController = new web_webview.WebviewController() - @State size: number = 13 + @State fontSize: number = 13 build() { Column() { Web({ src: 'www.example.com', controller: this.controller }) - .minLogicalFontSize(this.size) + .minLogicalFontSize(this.fontSize) } } } @@ -2484,6 +2484,7 @@ onWindowNew(callback: (event: {isAlert: boolean, isUserTrigger: boolean, targetU ```ts // xxx.ets + import web_webview from '@ohos.web.webview' @Entry @Component struct WebComponent { @@ -3297,7 +3298,7 @@ grant(resources: Array\): void | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | | --------- | --------------- | ---- | ---- | ------------- | -| resources | Array\ | 是 | - | 网页所请求的权限资源列表。 | +| resources | Array\ | 是 | - | 授予网页请求的权限的资源列表。 | ## ContextMenuSourceType9+枚举说明 | 名称 | 描述 | @@ -4956,7 +4957,7 @@ getCookie(url: string): string Column() { Button('getCookie') .onClick(() => { - let value = webview.WebCookieManager.getCookie('www.example.com') + let value = web_webview.WebCookieManager.getCookie('www.example.com') console.log("value: " + value) }) Web({ src: 'www.example.com', controller: this.controller }) @@ -5328,7 +5329,7 @@ deleteSessionCookie(): void Column() { Button('deleteSessionCookie') .onClick(() => { - webview.WebCookieManager.deleteSessionCookie() + web_webview.WebCookieManager.deleteSessionCookie() }) Web({ src: 'www.example.com', controller: this.controller }) } @@ -6495,7 +6496,7 @@ setPorts(ports: Array\): void ## DataResubmissionHandler9+ -通过DataResubmissionHandler可以重新提交表单数据或取消。 +通过DataResubmissionHandler可以重新提交表单数据或取消提交表单数据。 ### resend9+