提交 2be01724 编写于 作者: L laosan_ted

fix webview docs problems

Signed-off-by: Nlaosan_ted <wangruichang@huawei.com>
上级 08749dac
......@@ -192,7 +192,7 @@ loadUrl(url: string | Resource, headers?: Array\<HeaderV9>): void
| -------- | ------------------------------------------------------------ |
| 17100001 | Init error. The WebviewController must be associated with a Web component. |
| 17100002 | Invalid url. |
| 17100003 | Invalid resource. |
| 17100003 | Invalid resource path or file type. |
**示例:**
......@@ -1001,7 +1001,7 @@ zoom(factor: number): void
| 错误码ID | 错误信息 |
| -------- | ------------------------------------------------------------ |
| 17100001 | Init error. The WebviewController must be associated with a Web compoent. |
| 17100004 | Cannot delete JavaScriptProxy. |
| 17100004 | Function not enable. |
**示例:**
......@@ -2573,7 +2573,7 @@ static deleteOrigin(origin : string): void
| 错误码ID | 错误信息 |
| -------- | ------------------------------------------------------ |
| 17100011 | Invalid permission origin. |
| 17100011 | Invalid origin. |
**示例:**
......@@ -2625,7 +2625,7 @@ static getOrigins(callback: AsyncCallback\<Array\<WebStorageOrigin>>) : void
| 错误码ID | 错误信息 |
| -------- | ------------------------------------------------------ |
| 17100011 | Invalid permission origin. |
| 17100012 | Invalid web storage origin. |
**示例:**
......@@ -2686,7 +2686,7 @@ static getOrigins() : Promise\<Array\<WebStorageOrigin>>
| 错误码ID | 错误信息 |
| -------- | ------------------------------------------------------ |
| 17100011 | Invalid permission origin. |
| 17100012 | Invalid web storage origin. |
**示例:**
......@@ -2748,7 +2748,7 @@ static getOriginQuota(origin : string, callback : AsyncCallback\<number>) : void
| 错误码ID | 错误信息 |
| -------- | ------------------------------------------------------ |
| 17100011 | Invalid permission origin. |
| 17100011 | Invalid origin. |
**示例:**
......@@ -2812,7 +2812,7 @@ static getOriginQuota(origin : string) : Promise\<number>
| 错误码ID | 错误信息 |
| -------- | ------------------------------------------------------ |
| 17100011 | Invalid permission origin. |
| 17100011 | Invalid origin. |
**示例:**
......@@ -2871,7 +2871,7 @@ static getOriginUsage(origin : string, callback : AsyncCallback\<number>) : void
| 错误码ID | 错误信息 |
| -------- | ------------------------------------------------------ |
| 17100011 | Invalid permission origin. |
| 17100011 | Invalid origin. |
**示例:**
......@@ -2935,7 +2935,7 @@ static getOriginUsage(origin : string) : Promise\<number>
| 错误码ID | 错误信息 |
| -------- | ----------------------------------------------------- |
| 17100011 | Invalid permission origin. |
| 17100011 | Invalid origin. |
**示例:**
......@@ -3213,7 +3213,7 @@ static allowGeolocation(origin: string): void
以下错误码的详细介绍请参见 [webview错误码](../errorcodes/errorcode-webview.md)
| 错误码ID | 错误信息 |
| -------- | ------------------------------------------------------ |
| 17100011 | Invalid permission origin. |
| 17100011 | Invalid origin. |
**示例:**
......@@ -3263,7 +3263,7 @@ static deleteGeolocation(origin: string): void
| 错误码ID | 错误信息 |
| -------- | ------------------------------------------------------ |
| 17100011 | Invalid permission origin. |
| 17100011 | Invalid origin. |
**示例:**
......@@ -3314,7 +3314,7 @@ static getAccessibleGeolocation(origin: string, callback: AsyncCallback\<boolean
| 错误码ID | 错误信息 |
| -------- | ------------------------------------------------------ |
| 17100011 | Invalid permission origin. |
| 17100011 | Invalid origin. |
**示例:**
......@@ -3376,7 +3376,7 @@ static getAccessibleGeolocation(origin: string): Promise\<boolean>
| 错误码ID | 错误信息 |
| -------- | ------------------------------------------------------ |
| 17100011 | Invalid permission origin. |
| 17100011 | Invalid origin. |
**示例:**
......
......@@ -581,7 +581,7 @@ cacheMode(cacheMode: CacheMode)
}
```
### textZoomRatio
### textZoomRatio<sup>9+</sup>
textZoomRatio(textZoomRatio: number)
......@@ -611,6 +611,36 @@ textZoomRatio(textZoomRatio: number)
}
```
### initialScale<sup>9+</sup>
initialScale(percent: number)
设置整体页面的缩放百分比,默认为100%。
**参数:**
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| ------------ | ------ | ---- | ---- | --------------- |
| percent | number | 是 | 100 | 要设置的整体页面的缩放百分比。 |
**示例:**
```ts
// xxx.ets
@Entry
@Component
struct WebComponent {
controller: WebController = new WebController()
@State percent: number = 100
build() {
Column() {
Web({ src: 'www.example.com', controller: this.controller })
.initialScale(this.percent)
}
}
}
```
### userAgent
userAgent(userAgent: string)
......@@ -1345,6 +1375,71 @@ onShowFileSelector(callback: (event?: { result: FileSelectorResult, fileSelector
}
```
### onResourceLoad<sup>9+</sup>
onResourceLoad(callback: (event: {url: string}) => void)
通知Web组件所加载的资源文件url信息。
**参数:**
| 参数名 | 参数类型 | 参数描述 |
| ---- | ---------------------------------------- | --------- |
| url | string | 所加载的资源文件url信息。 |
**示例:**
```ts
// xxx.ets
@Entry
@Component
struct WebComponent {
controller: WebController = new WebController()
build() {
Column() {
Web({ src: 'www.example.com', controller: this.controller })
.onResourceLoad((event) => {
console.log('onResourceLoad: ' + event.url)
})
}
}
}
```
### onScaleChange<sup>9+</sup>
onScaleChange(callback: (event: {oldScale: number, newScale: number}) => void)
当前页面显示比例的变化时触发该回调。
**参数:**
| 参数名 | 参数类型 | 参数描述 |
| ---- | ---------------------------------------- | --------- |
| oldScale | number | 变化前的显示比例百分比。 |
| newScale | number | 变化后的显示比例百分比。 |
**示例:**
```ts
// xxx.ets
@Entry
@Component
struct WebComponent {
controller: WebController = new WebController()
build() {
Column() {
Web({ src: 'www.example.com', controller: this.controller })
.onScaleChange((event) => {
console.log('onScaleChange changed from ' + event.oldScale + ' to ' + event.newScale)
})
}
}
}
```
### onUrlLoadIntercept
onUrlLoadIntercept(callback: (event?: { data:string | WebResourceRequest }) => boolean)
......@@ -1793,6 +1888,38 @@ onGeolocationShow(callback: (event?: { origin: string, geolocation: JsGeolocatio
}
```
### onGeolocationHide
onGeolocationHide(callback: () => void)
通知用户先前被调用[onGeolocationShow](#ongeolocationshow)时收到地理位置信息获取请求已被取消。
**参数:**
| 参数名 | 参数类型 | 参数描述 |
| ----------- | ------------------------------- | ---------------- |
| callback | () => void | 地理位置信息获取请求已被取消的回调函数。 |
**示例:**
```ts
// xxx.ets
@Entry
@Component
struct WebComponent {
controller:WebController = new WebController()
build() {
Column() {
Web({ src:'www.example.com', controller:this.controller })
.geolocationAccess(true)
.onGeolocationHide(() => {
console.log("onGeolocationHide...")
})
}
}
}
```
### onFullScreenEnter<sup>9+</sup>
onFullScreenEnter(callback: (event: { handler: FullScreenExitHandler }) => void)
......@@ -1922,7 +2049,7 @@ onWindowExit(callback: () => void)
build() {
Column() {
Web({ src:'www.example.com', controller: this.controller })
.onWindowExit((event) => {
.onWindowExit(() => {
console.log("onWindowExit...")
})
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册