提交 ad7223db 编写于 作者: L lixingchi1

add the Web doc for 1.0.

Signed-off-by: Nlixingchi1 <lixingchi1@huawei.com>
上级 3a95d3c9
......@@ -60,6 +60,7 @@
- [toolbar](js-components-basic-toolbar.md)
- [toolbar-item](js-components-basic-toolbar-item.md)
- [toggle](js-components-basic-toggle.md)
- [web](js-components-basic-web.md)
- [媒体组件](js-components-media.md)
- [video](js-components-media-video.md)
......
# web
展示网页内容的组件。
>![](../../public_sys-resources/icon-note.gif) **说明:**
> 该组件从API version 6开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
## 权限列表
ohos.permission.INTERNET
## 约束
web组件不跟随转场动画。一个页面仅支持一个web组件。
## 子组件
不支持。
## 属性
| 名称 | 参数类型 | 默认值 | 必填 | 描述 |
| -------- | -------- | -------- | -------- | -------- |
| src | string | - | 否 |设置需要显示网页的地址,网址的域名必须为https协议且经过ICP备案。|
| id | string | - | 否 | 组件的唯一标识。 |
## 样式
不支持通用样式设置。
## 事件
仅支持如下事件:
| 名称 | 参数 | 描述 |
| -------- | -------- | -------- |
| pagestart | {url: string} | 加载网页时触发。 |
| pagefinish | {url: string} | 网页加载结束时触发。 |
| error | {url: string, errorCode: number, description: string} | 加载网页出现错误时触发或打开网页出错时触发。 |
## 方法
仅支持如下方法:
| 名称 | 参数 | 描述 |
| -------- | -------- | -------- |
| reload | - | 重新加载页面。 |
## 示例
```
<!-- xxx.hml -->
<div style="height: 500px; width: 500px; flex-direction: column;">
<button onclick="reloadWeb">click to reload</button>
<web src="www.example.com" id="web" onpagestart="pageStart" onpagefinish="pageFinish" on:error="pageError"></web>
</div>
```
```
<!-- xxx.js -->
export default {
reloadWeb() {
this.$element('web').reload()
},
pageStart: function(e) {
console.info('web pageStart: ' + e.url)
},
pageFinish: function(e) {
console.info('web pageFinish: ' + e.url)
},
pageError: function(e) {
console.info('web pageError url: ' + e.url)
console.info('web pageError errorCode: ' + e.errorCode)
console.info('web pageError description: ' + e.description)
}
}
```
\ No newline at end of file
......@@ -57,22 +57,22 @@
- [Divider](ts-basic-components-divider.md)
- [Image](ts-basic-components-image.md)
- [ImageAnimator](ts-basic-components-imageanimator.md)
- [LoadingProgress](ts-basic-components-loadingprogress.md)
- [Progress](ts-basic-components-progress.md)
- [QRCode](ts-basic-components-qrcode.md)
- [Radio](ts-basic-components-radio.md)
- [Rating](ts-basic-components-rating.md)
- [Span](ts-basic-components-span.md)
- [Select](ts-basic-components-select.md)
- [Slider](ts-basic-components-slider.md)
- [Span](ts-basic-components-span.md)
- [Text](ts-basic-components-text.md)
- [TextArea](ts-basic-components-textarea.md)
- [TextInput](ts-basic-components-textinput.md)
- [TextPicker](ts-basic-components-textpicker.md)
- [TextTimer](ts-basic-components-texttimer.md)
- [Toggle](ts-basic-components-toggle.md)
- [Select](ts-basic-components-select.md)
- [TextClock](ts-basic-components-textclock.md)
- [LoadingProgress](ts-basic-components-loadingprogress.md)
- [Web](ts-media-components-web.md)
- [Web](ts-basic-components-web.md)
- 容器组件
- [AlphabetIndexer](ts-container-alphabet-indexer.md)
- [Badge](ts-container-badge.md)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册