函数:webview.new 创建 webview
函数名称:创建 webview
函数功能:创建一个 webview
引擎版本:iOS v2.3.9,Android v2.3.4 以上
函数方法
local myweb1,err = webview.new(webview_name,{originx,originy,height,width,cornerRadius,orient,root,index,html})
| 参数 | 类型 | 必填 | 说明 | 默认值 |
|---|---|---|---|---|
| webview_name | string | 是 | webview 的名字, 可以通过不同的名字同时创建多个 webview |
- |
| originx | number | 否 | 左上角 x 点坐标 | 0 |
| originy | number | 否 | 左上角 y 点坐标 | 0 |
| height | number | 否 | 高度 | 全屏 |
| width | number | 否 | 宽度 | 全屏 |
| cornerRadius | number | 否 | 圆角 | 0 |
| orient | number | 否 | webview 方向,0 - 3,和 init 方向一致(仅支持 iOS) | 0 |
| root | string | 否 | webview 在文件系统里个根路径, 缺省 userPath().."/res" |
"" |
| index | string | 否 | webview 的入口文件名, 如果设置了 html,这个参数就无效了 |
"index.html“ |
| html | string | 否 | 主文件的 html | "" |
| 返回值 | 类型 | 说明 |
|---|---|---|
| myweb1 | table/boolean | 创建 webview 成功返回一个 table,失败返回 false |
| err | string | 创建 webview 失败,err 返回错误信息 |
函数用例
- 见完整例子