管理应用窗口界面,实现窗口的逻辑控制管理操作
-
-
beginPullRefresh()
-
当前Webview窗口的手动触发下拉刷新效果
前提是设置了下拉刷新效果Example
this.plus.beginPullRefresh();
-
close(w [, closeOpts])
-
关闭窗体
Parameters:
Name Type Argument Description w
String | window | WebviewObject 窗体对象或窗体id
closeOpts
* <可选>
关闭参数
Properties
Name Type Argument Default Description aniHide
String <可选>
'none'|'auto' 关闭窗口的动画效果,非显示栈顶的窗口的默认值为'none'
duration
Number <可选>
300 关闭窗口动画的持续时间
Example
// 根据id关闭 this.plus.close('login')
-
create(url [, id] [, opts])
-
创建新窗口
Parameters:
Name Type Argument Description url
String 新窗口加载的HTML页面地址
id
String <可选>
新窗口的标识
opts
Object <可选>
参数
Properties
Name Type Argument Description ext
JSON <可选>
创建窗口的额外扩展参数,设置扩展参数后可以直接通过窗口对象的点(“.”)操作符获取扩展参数属性值。
style
Object <可选>
创建窗口的样式(如窗口宽、高、位置等信息),参考HTML5+ API。
Returns:
窗体对象
- Type
- window | WebviewObject
Example
this.plus.create('login.html')
-
errorPage(url)
-
设置自定义错误页面
Parameters:
Name Type Description url
String 错误页面路径,必须是本地路径(Hbuilder的)
Example
// 路径,必须是本地路径(Hbuilder项目的) this.plus.errorPage('/error.html')
-
getHomeWin()
-
获取home窗体
Returns:
窗体对象
- Type
- window | WebviewObject
Example
this.plus.getHomeWin()
-
getWin(w)
-
获取窗体
Parameters:
Name Type Description w
String | window | WebviewObject 窗体对象或窗体id
Returns:
窗体对象
- Type
- window | WebviewObject
Example
// 取得当前窗体 this.plus.getWin() // 获取id为‘login’的窗体 this.plus.getWin('login')
-
goHome()
-
到首页
-
hide(w [, hideOpts])
-
隐藏窗体
Parameters:
Name Type Argument Description w
String | window | WebviewObject 窗体对象或窗体id
hideOpts
Object <可选>
隐藏参数
Properties
Name Type Argument Default Description aniHide
String <可选>
'none'|'auto' 隐藏窗口的动画效果,非显示栈顶的窗口的默认值为'none'
duration
Number <可选>
300 隐藏窗口动画的持续时间
Example
// 根据id隐藏 this.plus.hide('login')
-
isHome(w)
-
是否主页
Parameters:
Name Type Description w
String | window | WebviewObject Returns:
是不是主页
- Type
- Boolean
-
isTop(w)
-
是否顶层窗口
Parameters:
Name Type Description w
String | window | WebviewObject Returns:
是不是顶层窗口
- Type
- Boolean
-
menu(url [, id] [, opts])
-
创建并打开侧滑窗口
Parameters:
Name Type Argument Description url
String 新窗口加载的HTML页面地址
id
String <可选>
新窗口的标识
opts
Object <可选>
参数
Properties
Name Type Argument Default Description loading
Boolean <可选>
true 是否显示loading等待效果
ani
Object <可选>
显示窗口的动画
Properties
Name Type Argument Default Description aniShow
String <可选>
'slide-in-right' 显示窗口的动画效果
duration
Number <可选>
300 显示窗口动画的持续时间
ext
JSON <可选>
创建窗口的额外扩展参数,设置扩展参数后可以直接通过窗口对象的点(“.”)操作符获取扩展参数属性值。
style
Object <可选>
创建窗口的样式(如窗口宽、高、位置等信息),参考HTML5+ API。
Returns:
侧滑窗体对象
- Type
- window | WebviewObject
Examples
this.plus.open('index.html', "menuLeft", { ani: { aniShow: "slide-in-left" }, style: { right: "30%", width: "70%", popGesture: "none" } });
this.plus.open('index.html', "menuRight", { ani: { aniShow: "slide-in-right" }, style: { left: "30%", width: "70%", popGesture: "none" } });
this.plus.open('index.html', "menuBottom", { ani: { aniShow: "slide-in-bottom" }, style: { height: "30%", top: "70%", popGesture: "none" } });
this.plus.open('index.html', "menuTop", { ani: { aniShow: "slide-in-top" }, style: { height: "30%", bottom: "70%", popGesture: "none" } });
-
open(url [, id] [, opts])
-
创建并打开新窗口
Parameters:
Name Type Argument Description url
String 新窗口加载的HTML页面地址
id
String <可选>
新窗口的标识
opts
Object <可选>
参数
Properties
Name Type Argument Default Description loading
Boolean <可选>
true 是否显示loading等待效果
ani
Object <可选>
显示窗口的动画
Properties
Name Type Argument Default Description aniShow
String <可选>
'slide-in-right' 显示窗口的动画效果
duration
Number <可选>
300 显示窗口动画的持续时间
ext
JSON <可选>
创建窗口的额外扩展参数,设置扩展参数后可以直接通过窗口对象的点(“.”)操作符获取扩展参数属性值。
style
Object <可选>
创建窗口的样式(如窗口宽、高、位置等信息),参考HTML5+ API。
Returns:
窗体对象
- Type
- window | WebviewObject
Example
this.plus.open('login.html', "login", { ext: { uid: 121 } });
-
openBrowser(url)
-
用浏览器打开url
Parameters:
Name Type Description url
String 页面地址
Example
this.plus.openBrowser('http://www.baidu.com');
-
pullRefresh( [style] [, callback])
-
当前Webview窗口的下拉刷新效果
Parameters:
Name Type Argument Default Description style
Object <可选>
{} Webview窗口下拉刷新样式,参考HTML5+ API
callback
function <可选>
()=>{} Webview窗口下拉刷新事件回调,接收的参数为:结束Webview窗口的下拉刷新function
Examples
this.plus.pullRefresh({ support: true, color: "#2BD009", style: "circle", offset: "0px", range: "80px", height: "50px" }, function(end) { setTimeout(() => { end(); }, 1000); } );
this.plus.pullRefresh({ support: true, style: "default", range: "30px", height: "30px", contentdown: { caption: "下拉可以刷新" }, contentover: { caption: "释放立即刷新" }, contentrefresh: { caption: "正在刷新..." } }, function(end) { setTimeout(() => { end(); }, 1000); } );
this.plus.pullRefresh({ support: false }); this.plus.pullRefresh();
-
show(w [, opts])
-
显示窗体
Parameters:
Name Type Argument Description w
String | window | WebviewObject 窗体对象或窗体id
opts
Object <可选>
显示参数
Properties
Name Type Argument Default Description loading
Boolean <可选>
true 是否显示loading等待效果
ani
Object <可选>
显示窗口的动画
Properties
Name Type Argument Default Description aniShow
String <可选>
'slide-in-right' 显示窗口的动画效果
duration
Number <可选>
300 显示窗口动画的持续时间
Example
// 根据id显示 this.plus.show('login')