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 b36d53850374ba5f4769d92629978b2529263c99..81c95ab4260f350acb4744131bbc05bd0163a5f7 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-webview.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-webview.md
@@ -11,6 +11,7 @@
> - 示例效果请以真机运行为准,当前IDE预览器不支持。
## 需要权限
+
访问在线网页时需添加网络权限:ohos.permission.INTERNET,具体申请方式请参考[权限申请声明](../../security/accesstoken-guidelines.md)。
## 导入模块
@@ -248,7 +249,7 @@ export default class MainAbility extends Ability {
```ts
// xxx.ets
-import web_webview from '@ohos.web.webview'
+import web_webview from '@ohos.web.webview';
@Entry
@Component
@@ -1438,7 +1439,7 @@ struct WebComponent {
**系统能力:** SystemCapability.Web.Webview.Core
-**返回值:**
+**返回值:**
| 类型 | 说明 |
| ---------------------- | ----------------- |
@@ -1452,7 +1453,7 @@ struct WebComponent {
| -------- | ------------------------------------------------------------ |
| 17100001 | Init error. The WebviewController must be associated with a Web component. |
-**示例:**
+**示例:**
```ts
// xxx.ets
@@ -1536,7 +1537,7 @@ struct WebComponent {
this.ports = this.controller.createWebMessagePorts();
// 2、在应用侧的消息端口(如端口1)上注册回调事件。
this.ports[1].onMessageEvent((result: web_webview.WebMessage) => {
- var msg = 'Got msg from HTML:';
+ let msg = 'Got msg from HTML:';
if (typeof(result) == "string") {
console.log("received string message from html5, string is:" + result);
msg = msg + result;
@@ -3495,7 +3496,7 @@ static existCookie(): boolean
**系统能力:** SystemCapability.Web.Webview.Core
-**返回值:**
+**返回值:**
| 类型 | 说明 |
| ------- | -------------------------------------- |
@@ -4228,133 +4229,6 @@ struct WebComponent {
}
```
-## WebAsyncController
-
-通过WebAsyncController可以控制Web组件具有异步回调通知的行为,一个WebAsyncController对象控制一个Web组件。
-
-### 创建对象
-
- ```ts
- // xxx.ets
- import web_webview from '@ohos.web.webview'
-
- @Entry
- @Component
- struct WebComponent {
- controller: WebController = new WebController();
- webAsyncController: web_webview.WebAsyncController = new web_webview.WebAsyncController(this.controller)
- build() {
- Column() {
- Web({ src: 'www.example.com', controller: this.controller })
- }
- }
- }
- ```
-
-### constructor9+
-
-constructor(controller: WebController)
-
-WebAsyncController的创建需要与一个[WebController](../arkui-ts/ts-basic-components-web.md#webcontroller)进行绑定。
-
-**系统能力:** SystemCapability.Web.Webview.Core
-
-**参数:**
-
-| 参数名| 类型 | 必填 | 说明 |
-| ----- | ---- | ---- | --- |
-| controller | [WebController](../arkui-ts/ts-basic-components-web.md#webcontroller) | 是 | 所绑定的WebviewController。|
-
-### storeWebArchive9+
-
-storeWebArchive(baseName: string, autoName: boolean, callback: AsyncCallback\): void
-
-以回调方式异步保存当前页面。
-
-**系统能力:** SystemCapability.Web.Webview.Core
-
-**参数:**
-
-| 参数名 | 类型 | 必填 | 说明 |
-| -------- | ---------------------------------------- | ---- | ----------------------------------- |
-| baseName | string | 是 | 文件存储路径,该值不能为空。
-| autoName | boolean | 是 | 决定是否自动生成文件名。
如果为false,则将baseName作为文件存储路径。
如果为true,则假定baseName是一个目录,将根据当前页的Url自动生成文件名。
-| callback | AsyncCallback\ | 是 | 返回文件存储路径,保持网页失败会返回null。 |
-
-**示例:**
-
- ```ts
- // xxx.ets
- import web_webview from '@ohos.web.webview'
- @Entry
- @Component
- struct WebComponent {
- controller: WebController = new WebController()
- build() {
- Column() {
- Button('saveWebArchive')
- .onClick(() => {
- let webAsyncController = new web_webview.WebAsyncController(this.controller)
- webAsyncController.storeWebArchive("/data/storage/el2/base/", true, (filename) => {
- if (filename != null) {
- console.info(`save web archive success: ${filename}`)
- }
- })
- })
- Web({ src: 'www.example.com', controller: this.controller })
- }
- }
- }
- ```
-
-### storeWebArchive9+
-
-storeWebArchive(baseName: string, autoName: boolean): Promise\
-
-以Promise方式异步保存当前页面。
-
-**系统能力:** SystemCapability.Web.Webview.Core
-
-**参数:**
-
-| 参数名 | 类型 | 必填 | 说明 |
-| -------- | ---------------------------------------- | ---- | ----------------------------------- |
-| baseName | string | 是 | 文件存储路径,该值不能为空。
-| autoName | boolean | 是 | 决定是否自动生成文件名。
如果为false,则将baseName作为文件存储路径。
如果为true,则假定baseName是一个目录,将根据当前页的Url自动生成文件名。
-
-**返回值:**
-
-| 类型 | 说明 |
-| ---------------------------------------- | ---------------------------------------- |
-| Promise | Promise实例,保存成功返回文件路径,保存失败返回null。 |
-
-**示例:**
-
- ```ts
- // xxx.ets
- import web_webview from '@ohos.web.webview'
- @Entry
- @Component
- struct WebComponent {
- controller: WebController = new WebController();
- build() {
- Column() {
- Button('saveWebArchive')
- .onClick(() => {
- let webAsyncController = new web_webview.WebAsyncController(this.controller);
- webAsyncController.storeWebArchive("/data/storage/el2/base/", true)
- .then(filename => {
- if (filename != null) {
- console.info(`save web archive success: ${filename}`)
- }
- })
- })
- Web({ src: 'www.example.com', controller: this.controller })
- }
- }
- }
- ```
-
## GeolocationPermissions
web组件地理位置权限管理对象。
@@ -4845,7 +4719,6 @@ struct WebComponent {
| historyRawUrl | string | 是 | 否 | 历史记录项的原始url地址。 |
| title | string | 是 | 否 | 历史记录项的标题。 |
-
## WebCustomScheme
自定义协议配置。
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 88a2104b26a7b57b2415ca460acbb865f01617b3..6d88aff8568c3a6a774c2f2af509676faecd8b49 100644
--- 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
@@ -2,7 +2,7 @@
提供具有网页显示能力的Web组件。
-> **说明:**
+> **说明:**
>
> - 该组件从API Version 8开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
> - 示例效果请以真机运行为准,当前IDE预览器不支持。
@@ -745,36 +745,6 @@ userAgent(userAgent: string)
}
```
-### webDebuggingAccess9+
-
-webDebuggingAccess(webDebuggingAccess: boolean)
-
-设置是否启用网页调试功能。
-
-**参数:**
-
-| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
-| ------------------ | ------- | ---- | ----- | ------------- |
-| webDebuggingAccess | boolean | 是 | false | 设置是否启用网页调试功能。 |
-
-**示例:**
-
- ```ts
- // xxx.ets
- @Entry
- @Component
- struct WebComponent {
- controller: WebController = new WebController()
- @State webDebuggingAccess: boolean = true
- build() {
- Column() {
- Web({ src: 'www.example.com', controller: this.controller })
- .webDebuggingAccess(this.webDebuggingAccess)
- }
- }
- }
- ```
-
### blockNetwork9+
blockNetwork(block: boolean)
@@ -805,6 +775,7 @@ blockNetwork(block: boolean)
}
}
```
+
### defaultFixedFontSize9+
defaultFixedFontSize(size: number)
@@ -1300,7 +1271,7 @@ onBeforeUnload(callback: (event?: { url: string; message: string; result: JsResu
@Component
struct WebComponent {
controller: WebController = new WebController()
-
+
build() {
Column() {
Web({ src: 'www.example.com', controller: this.controller })
@@ -1361,7 +1332,7 @@ onConfirm(callback: (event?: { url: string; message: string; result: JsResult })
@Component
struct WebComponent {
controller: WebController = new WebController()
-
+
build() {
Column() {
Web({ src: 'www.example.com', controller: this.controller })
@@ -1421,7 +1392,7 @@ onPrompt(callback: (event?: { url: string; message: string; value: string; resul
@Component
struct WebComponent {
controller: WebController = new WebController()
-
+
build() {
Column() {
Web({ src: 'www.example.com', controller: this.controller })
@@ -1481,7 +1452,7 @@ onConsole(callback: (event?: { message: ConsoleMessage }) => boolean)
@Component
struct WebComponent {
controller: WebController = new WebController()
-
+
build() {
Column() {
Web({ src: 'www.example.com', controller: this.controller })
@@ -1518,7 +1489,7 @@ onDownloadStart(callback: (event?: { url: string, userAgent: string, contentDisp
@Component
struct WebComponent {
controller: WebController = new WebController()
-
+
build() {
Column() {
Web({ src: 'www.example.com', controller: this.controller })
@@ -1555,7 +1526,7 @@ onErrorReceive(callback: (event?: { request: WebResourceRequest, error: WebResou
@Component
struct WebComponent {
controller: WebController = new WebController()
-
+
build() {
Column() {
Web({ src: 'www.example.com', controller: this.controller })
@@ -1599,7 +1570,7 @@ onHttpErrorReceive(callback: (event?: { request: WebResourceRequest, response: W
@Component
struct WebComponent {
controller: WebController = new WebController()
-
+
build() {
Column() {
Web({ src: 'www.example.com', controller: this.controller })
@@ -1650,7 +1621,7 @@ onPageBegin(callback: (event?: { url: string }) => void)
@Component
struct WebComponent {
controller: WebController = new WebController()
-
+
build() {
Column() {
Web({ src: 'www.example.com', controller: this.controller })
@@ -1683,7 +1654,7 @@ onPageEnd(callback: (event?: { url: string }) => void)
@Component
struct WebComponent {
controller: WebController = new WebController()
-
+
build() {
Column() {
Web({ src: 'www.example.com', controller: this.controller })
@@ -1715,7 +1686,7 @@ onProgressChange(callback: (event?: { newProgress: number }) => void)
@Component
struct WebComponent {
controller: WebController = new WebController()
-
+
build() {
Column() {
Web({ src: 'www.example.com', controller: this.controller })
@@ -1747,7 +1718,7 @@ onTitleReceive(callback: (event?: { title: string }) => void)
@Component
struct WebComponent {
controller: WebController = new WebController()
-
+
build() {
Column() {
Web({ src: 'www.example.com', controller: this.controller })
@@ -1780,7 +1751,7 @@ onRefreshAccessedHistory(callback: (event?: { url: string, isRefreshed: boolean
@Component
struct WebComponent {
controller: WebController = new WebController()
-
+
build() {
Column() {
Web({ src: 'www.example.com', controller: this.controller })
@@ -1812,7 +1783,7 @@ onRenderExited(callback: (event?: { renderExitReason: RenderExitReason }) => voi
@Component
struct WebComponent {
controller: WebController = new WebController()
-
+
build() {
Column() {
Web({ src: 'chrome://crash/', controller: this.controller })
@@ -1900,7 +1871,7 @@ onResourceLoad(callback: (event: {url: string}) => void)
@Component
struct WebComponent {
controller: WebController = new WebController()
-
+
build() {
Column() {
Web({ src: 'www.example.com', controller: this.controller })
@@ -1933,7 +1904,7 @@ onScaleChange(callback: (event: {oldScale: number, newScale: number}) => void)
@Component
struct WebComponent {
controller: WebController = new WebController()
-
+
build() {
Column() {
Web({ src: 'www.example.com', controller: this.controller })
@@ -1971,7 +1942,7 @@ onUrlLoadIntercept(callback: (event?: { data:string | WebResourceRequest }) => b
@Component
struct WebComponent {
controller: WebController = new WebController()
-
+
build() {
Column() {
Web({ src: 'www.example.com', controller: this.controller })
@@ -2079,7 +2050,7 @@ onHttpAuthRequest(callback: (event?: { handler: HttpAuthHandler, host: string, r
struct WebComponent {
controller: WebController = new WebController()
httpAuth: boolean = false
-
+
build() {
Column() {
Web({ src: 'www.example.com', controller: this.controller })
@@ -2140,7 +2111,7 @@ onSslErrorEventReceive(callback: (event: { handler: SslErrorHandler, error: SslE
@Component
struct WebComponent {
controller: WebController = new WebController()
-
+
build() {
Column() {
Web({ src: 'www.example.com', controller: this.controller })
@@ -2694,7 +2665,7 @@ onInterceptKeyEvent(callback: (event: KeyEvent) => boolean)
Column() {
Web({ src:'www.example.com', controller: this.controller })
.onInterceptKeyEvent((event) => {
- if (event.keyCode == 2017 || event.keyCode == 2018) {
+ if (event.keyCode == 2017 || event.keyCode == 2018) {
console.info(`onInterceptKeyEvent get event.keyCode ${event.keyCode}`)
return true;
}
@@ -2783,7 +2754,7 @@ getLineNumber(): number
获取ConsoleMessage的行数。
-**返回值:**
+**返回值:**
| 类型 | 说明 |
| ------ | -------------------- |
@@ -2795,7 +2766,7 @@ getMessage(): string
获取ConsoleMessage的日志信息。
-**返回值:**
+**返回值:**
| 类型 | 说明 |
| ------ | ---------------------- |
@@ -2807,7 +2778,7 @@ getMessageLevel(): MessageLevel
获取ConsoleMessage的信息级别。
-**返回值:**
+**返回值:**
| 类型 | 说明 |
| --------------------------------- | ---------------------- |
@@ -2819,7 +2790,7 @@ getSourceId(): string
获取网页源文件路径和名字。
-**返回值:**
+**返回值:**
| 类型 | 说明 |
| ------ | ------------- |
@@ -2889,7 +2860,7 @@ getErrorCode(): number
获取加载资源的错误码。
-**返回值:**
+**返回值:**
| 类型 | 说明 |
| ------ | ----------- |
@@ -2901,7 +2872,7 @@ getErrorInfo(): string
获取加载资源的错误信息。
-**返回值:**
+**返回值:**
| 类型 | 说明 |
| ------ | ------------ |
@@ -2917,7 +2888,7 @@ getResponseHeader() : Array\
获取资源请求头信息。
-**返回值:**
+**返回值:**
| 类型 | 说明 |
| -------------------------- | ---------- |
@@ -2929,7 +2900,7 @@ getRequestUrl(): string
获取资源请求的URL信息。
-**返回值:**
+**返回值:**
| 类型 | 说明 |
| ------ | ------------- |
@@ -2941,7 +2912,7 @@ isMainFrame(): boolean
判断资源请求是否为主frame。
-**返回值:**
+**返回值:**
| 类型 | 说明 |
| ------- | ---------------- |
@@ -2953,7 +2924,7 @@ isRedirect(): boolean
判断资源请求是否被服务端重定向。
-**返回值:**
+**返回值:**
| 类型 | 说明 |
| ------- | ---------------- |
@@ -2965,7 +2936,7 @@ isRequestGesture(): boolean
获取资源请求是否与手势(如点击)相关联。
-**返回值:**
+**返回值:**
| 类型 | 说明 |
| ------- | -------------------- |
@@ -2991,7 +2962,7 @@ getReasonMessage(): string
获取资源响应的状态码描述。
-**返回值:**
+**返回值:**
| 类型 | 说明 |
| ------ | ------------- |
@@ -3003,7 +2974,7 @@ getResponseCode(): number
获取资源响应的状态码。
-**返回值:**
+**返回值:**
| 类型 | 说明 |
| ------ | ----------- |
@@ -3015,7 +2986,7 @@ getResponseData(): string
获取资源响应数据。
-**返回值:**
+**返回值:**
| 类型 | 说明 |
| ------ | --------- |
@@ -3027,7 +2998,7 @@ getResponseEncoding(): string
获取资源响应的编码。
-**返回值:**
+**返回值:**
| 类型 | 说明 |
| ------ | ---------- |
@@ -3039,7 +3010,7 @@ getResponseHeader() : Array\
获取资源响应头。
-**返回值:**
+**返回值:**
| 类型 | 说明 |
| -------------------------- | -------- |
@@ -3051,7 +3022,7 @@ getResponseMimeType(): string
获取资源响应的媒体(MIME)类型。
-**返回值:**
+**返回值:**
| 类型 | 说明 |
| ------ | ------------------ |
@@ -3161,25 +3132,13 @@ handleFileList(fileList: Array\): void
web组件获取文件对象。示例代码参考[onShowFileSelector事件](#onshowfileselector9)。
-### getTitle9+
-
-getTitle(): string
-
-获取文件选择器标题。
-
-**返回值:**
-
-| 类型 | 说明 |
-| ------ | ---------- |
-| string | 返回文件选择器标题。 |
-
### getMode9+
getMode(): FileSelectorMode
获取文件选择器的模式。
-**返回值:**
+**返回值:**
| 类型 | 说明 |
| ---------------------------------------- | ----------- |
@@ -3191,7 +3150,7 @@ getAcceptType(): Array\
获取文件过滤类型。
-**返回值:**
+**返回值:**
| 类型 | 说明 |
| --------------- | --------- |
@@ -3203,7 +3162,7 @@ isCapture(): boolean
获取是否调用多媒体能力。
-**返回值:**
+**返回值:**
| 类型 | 说明 |
| ------- | ------------ |
@@ -3339,7 +3298,7 @@ grant(resources: Array\): void
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| --------- | --------------- | ---- | ---- | ------------- |
-| resources | Array\ | 是 | - | 网页所请求的权限资源列表。 |
+| resources | Array\ | 是 | - | 授予网页请求的权限的资源列表。 |
## ContextMenuSourceType9+枚举说明
| 名称 | 描述 |
@@ -3610,7 +3569,7 @@ requestFocus()
@Component
struct WebComponent {
controller: WebController = new WebController()
-
+
build() {
Column() {
Button('requestFocus')
@@ -3645,7 +3604,7 @@ accessBackward(): boolean
@Component
struct WebComponent {
controller: WebController = new WebController()
-
+
build() {
Column() {
Button('accessBackward')
@@ -3681,7 +3640,7 @@ accessForward(): boolean
@Component
struct WebComponent {
controller: WebController = new WebController()
-
+
build() {
Column() {
Button('accessForward')
@@ -3724,7 +3683,7 @@ accessStep(step: number): boolean
struct WebComponent {
controller: WebController = new WebController()
@State steps: number = 2
-
+
build() {
Column() {
Button('accessStep')
@@ -3754,7 +3713,7 @@ backward(): void
@Component
struct WebComponent {
controller: WebController = new WebController()
-
+
build() {
Column() {
Button('backward')
@@ -3783,7 +3742,7 @@ forward(): void
@Component
struct WebComponent {
controller: WebController = new WebController()
-
+
build() {
Column() {
Button('forward')
@@ -3796,40 +3755,6 @@ forward(): void
}
```
-### backOrForward9+
-
-backOrForward(step: number): void
-
-按照历史栈,前进或者后退指定步长的页面,当历史栈中不存在对应步长的页面时,不会进行页面跳转。
-
-**参数:**
-
-| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
-| ---- | ------ | ---- | ---- | ----------- |
-| step | number | 是 | - | 需要前进或后退的步长。 |
-
-**示例:**
-
- ```ts
- // xxx.ets
- @Entry
- @Component
- struct WebComponent {
- controller: WebController = new WebController()
- @State step: number = -2
-
- build() {
- Column() {
- Button('backOrForward')
- .onClick(() => {
- this.controller.backOrForward(this.step)
- })
- Web({ src: 'www.example.com', controller: this.controller })
- }
- }
- }
- ```
-
### deleteJavaScriptRegister(deprecated)
deleteJavaScriptRegister(name: string)
@@ -3853,7 +3778,7 @@ deleteJavaScriptRegister(name: string)
struct WebComponent {
controller: WebController = new WebController()
@State name: string = 'Object'
-
+
build() {
Column() {
Button('deleteJavaScriptRegister')
@@ -3870,7 +3795,7 @@ deleteJavaScriptRegister(name: string)
getHitTest(): HitTestType
-获取当前被点击区域的元素类型。
+获取当前被点击区域的元素类型。
从API version 9开始不再维护,建议使用[getHitTest9+](../apis/js-apis-webview.md#gethittest)代替。
@@ -3888,7 +3813,7 @@ getHitTest(): HitTestType
@Component
struct WebComponent {
controller: WebController = new WebController()
-
+
build() {
Column() {
Button('getHitTest')
@@ -3902,73 +3827,6 @@ getHitTest(): HitTestType
}
```
-### getHitTestValue9+
-getHitTestValue(): HitTestValue
-
-获取当前被点击区域的元素信息。
-
-**返回值:**
-
-| 类型 | 说明 |
-| ------------------------------ | ---------- |
-| [HitTestValue](#hittestvalue9) | 点击区域的元素信息。 |
-
-**示例:**
-
- ```ts
- // xxx.ets
- @Entry
- @Component
- struct WebComponent {
- controller: WebController = new WebController()
-
- build() {
- Column() {
- Button('getHitTestValue')
- .onClick(() => {
- let hitValue = this.controller.getHitTestValue()
- console.log("hitType: " + hitValue.getType())
- console.log("extra: " + hitValue.getExtra())
- })
- Web({ src: 'www.example.com', controller: this.controller })
- }
- }
- }
- ```
-
-### getWebId9+
-getWebId(): number
-
-获取当前Web组件的索引值,用于多个Web组件的管理。
-
-**返回值:**
-
-| 类型 | 说明 |
-| ------ | ------------ |
-| number | 当前Web组件的索引值。 |
-
-**示例:**
-
- ```ts
- // xxx.ets
- @Entry
- @Component
- struct WebComponent {
- controller: WebController = new WebController()
-
- build() {
- Column() {
- Button('getWebId')
- .onClick(() => {
- let id = this.controller.getWebId()
- console.log("id: " + id)
- })
- Web({ src: 'www.example.com', controller: this.controller })
- }
- }
- }
- ```
-
### getTitle9+
getTitle(): string
@@ -3988,7 +3846,7 @@ getTitle(): string
@Component
struct WebComponent {
controller: WebController = new WebController()
-
+
build() {
Column() {
Button('getTitle')
@@ -4002,72 +3860,6 @@ getTitle(): string
}
```
-### getPageHeight9+
-getPageHeight(): number
-
-获取当前网页的页面高度。
-
-**返回值:**
-
-| 类型 | 说明 |
-| ------ | ---------- |
-| number | 当前网页的页面高度。 |
-
-**示例:**
-
- ```ts
- // xxx.ets
- @Entry
- @Component
- struct WebComponent {
- controller: WebController = new WebController()
-
- build() {
- Column() {
- Button('getPageHeight')
- .onClick(() => {
- let pageHeight = this.controller.getPageHeight()
- console.log("pageHeight: " + pageHeight)
- })
- Web({ src: 'www.example.com', controller: this.controller })
- }
- }
- }
- ```
-
-### getDefaultUserAgent9+
-getDefaultUserAgent(): string
-
-获取当前默认用户代理。
-
-**返回值:**
-
-| 类型 | 说明 |
-| ------ | ------- |
-| string | 默认用户代理。 |
-
-**示例:**
-
- ```ts
- // xxx.ets
- @Entry
- @Component
- struct WebComponent {
- controller: WebController = new WebController()
-
- build() {
- Column() {
- Button('getDefaultUserAgent')
- .onClick(() => {
- let userAgent = this.controller.getDefaultUserAgent()
- console.log("userAgent: " + userAgent)
- })
- Web({ src: 'www.example.com', controller: this.controller })
- }
- }
- }
- ```
-
### loadData(deprecated)
loadData(options: { data: string, mimeType: string, encoding: string, baseUrl?: string, historyUrl?: string })
@@ -4098,7 +3890,7 @@ baseUrl为空时,通过”data“协议加载指定的一段字符串。
@Component
struct WebComponent {
controller: WebController = new WebController()
-
+
build() {
Column() {
Button('loadData')
@@ -4142,7 +3934,7 @@ loadUrl(options: { url: string | Resource, headers?: Array\ })
@Component
struct WebComponent {
controller: WebController = new WebController()
-
+
build() {
Column() {
Button('loadUrl')
@@ -4171,7 +3963,7 @@ onActive(): void
@Component
struct WebComponent {
controller: WebController = new WebController()
-
+
build() {
Column() {
Button('onActive')
@@ -4200,7 +3992,7 @@ onInactive(): void
@Component
struct WebComponent {
controller: WebController = new WebController()
-
+
build() {
Column() {
Button('onInactive')
@@ -4235,7 +4027,7 @@ zoom(factor: number): void
struct WebComponent {
controller: WebController = new WebController()
@State factor: number = 1
-
+
build() {
Column() {
Button('zoom')
@@ -4248,72 +4040,6 @@ zoom(factor: number): void
}
```
-### zoomIn9+
-zoomIn(): boolean
-
-调用此接口将当前网页进行放大,比例为20%。
-
-**返回值:**
-
-| 类型 | 说明 |
-| ------- | ----------- |
-| boolean | 放大操作是否成功执行。 |
-
-**示例:**
-
- ```ts
- // xxx.ets
- @Entry
- @Component
- struct WebComponent {
- controller: WebController = new WebController()
-
- build() {
- Column() {
- Button('zoomIn')
- .onClick(() => {
- let result = this.controller.zoomIn()
- console.log("result: " + result)
- })
- Web({ src: 'www.example.com', controller: this.controller })
- }
- }
- }
- ```
-
-### zoomOut9+
-zoomOut(): boolean
-
-调用此接口将当前网页进行缩小,比例为20%。
-
-**返回值:**
-
-| 类型 | 说明 |
-| ------- | ----------- |
-| boolean | 缩小操作是否成功执行。 |
-
-**示例:**
-
- ```ts
- // xxx.ets
- @Entry
- @Component
- struct WebComponent {
- controller: WebController = new WebController()
-
- build() {
- Column() {
- Button('zoomOut')
- .onClick(() => {
- let result = this.controller.zoomOut()
- console.log("result: " + result)
- })
- Web({ src: 'www.example.com', controller: this.controller })
- }
- }
- }
- ```
-
### refresh(deprecated)
refresh()
@@ -4330,7 +4056,7 @@ refresh()
@Component
struct WebComponent {
controller: WebController = new WebController()
-
+
build() {
Column() {
Button('refresh')
@@ -4408,7 +4134,7 @@ registerJavaScriptProxy(options: { object: object, name: string, methodList: Arr
}