API
Class

Shell ($UI/system/lib/portal/shell)

使用范围:UI2

Contents

class Shell ($UI/system/lib/portal/shell)

shell API

Constructor Top

  Shell ()

Static Methods Top

void addPageMappings (JSON params)
void closeAll ()
void closeAllOpendedPages ()
void closePage (JSON params)
Array getOpenedPages ()
Promise loadPage (JSON params)
void off ( ename, fn, scope)
void on ( ename, fn, scope, options)
void setIsSinglePage ()
void showLeft ()
Promise showMainPage ()
void showPage (String url, JSON data)
void showRight ()

Events Top

void onAfterPageClose ($UI/system/lib/portal/shell#AfterPageCloseEvent event)
void onAfterPageLoad ($UI/system/lib/portal/shell#AfterPageLoadEvent event)
void onAfterPageLoad ($UI/system/lib/portal/shell#AfterPageLoadEvent event)
void onBeforePageClose ($UI/system/lib/portal/shell#BeforePageCloseEvent event)
void onBeforePageLoad ($UI/system/lib/portal/shell#BeforePageLoadEvent event)
void onBeforePageLoad ($UI/system/lib/portal/shell#BeforePageLoadEvent event)
void onPageActive ($UI/system/lib/portal/shell#PageActiveEvent event)
void onPageInactive ($UI/system/lib/portal/shell#PageInactiveEvent event)
void onPageViewLoad ($UI/system/lib/portal/shell#PageViewLoadEvent event)

Constructor details Top

public Shell ()

shell API

Static Methods Detail Top

static public void addPageMappings (JSON params)

添加页面映射信息

Parameters

JSON params

params 类似 {"main":{url:"$UI/portal/index.w"}}

Return Value

void

static public void closeAll ()

关闭所有页面包括首页,会一片白哦,除非你明确知道就需要这个效果 否则用这个api一定要慎重.

Parameters

Return Value

void

static public void closeAllOpendedPages ()

关闭所有已经打开的页面回到首页

Parameters

Return Value

void

static public void closePage (JSON params)

关闭当前页面

Parameters

JSON params

params 类似 {url:"$UI/portal/index.w"}

Return Value

void

static public Array getOpenedPages ()

获取所有已经打开的功能列表,返回一个数组,每项是用来装载页面的content实例

Parameters

Return Value

Array

static public Promise loadPage (JSON params)

加载页面

Parameters

JSON params

类似 {url:"$UI/portal/index.w"}

Return Value

Promise

static public void off ( ename, fn, scope)

删除事件监听器

Parameters

ename

事件名称

fn

事件处理器

scope

调用事件处理器的this

Return Value

void

static public void on ( ename, fn, scope, options)

添加事件监听器

Parameters

ename

事件名称

fn

事件处理器

scope

调用事件处理器的this

options

其它选项

Return Value

void

static public void setIsSinglePage ()

设置为单功能页模式

Return Value

void

static public void showLeft ()

显示左边栏

Return Value

void

static public Promise showMainPage ()

显示首页

Return Value

Promise

static public void showPage (String url, JSON data)

显示页面

Parameters

String url

url 类似 {url:"$UI/portal/index.w"} 或者 "$UI/portal/index.w"

JSON data

传递到页面的参数

Return Value

void

static public void showRight ()

显示右边栏

Return Value

void

Events Detail Top

public void onAfterPageClose ($UI/system/lib/portal/shell#AfterPageCloseEvent event)

[回调型事件] 页面关闭后事件

Parameters

$UI/system/lib/portal/shell#AfterPageCloseEvent event


结构如下:

{ data:{ closePageXid:removePageXid, toPageXid:toPageXid, closePageUrl:url } }

Return Value

void

public void onAfterPageLoad ($UI/system/lib/portal/shell#AfterPageLoadEvent event)

[回调型事件]功能加载后事件

Parameters

$UI/system/lib/portal/shell#AfterPageLoadEvent event


结构如下:

{ "data" : 打开page的参数 }

Return Value

void

public void onAfterPageLoad ($UI/system/lib/portal/shell#AfterPageLoadEvent event)

[回调型事件] 页面加载后事件

Parameters

$UI/system/lib/portal/shell#AfterPageLoadEvent event


结构如下:

{ data:加载参数 }

Return Value

void

public void onBeforePageClose ($UI/system/lib/portal/shell#BeforePageCloseEvent event)

[回调型事件] 页面关闭前事件

Parameters

$UI/system/lib/portal/shell#BeforePageCloseEvent event


结构如下:

{ data:{ closePageXid:removePageXid, toPageXid:toPageXid, closePageUrl:url } }

Return Value

void

public void onBeforePageLoad ($UI/system/lib/portal/shell#BeforePageLoadEvent event)

[回调型事件]功能打开前事件

Parameters

$UI/system/lib/portal/shell#BeforePageLoadEvent event


结构如下:

{ "data" : 打开page的参数, "cancel" : 是否取消 }

Return Value

void

public void onBeforePageLoad ($UI/system/lib/portal/shell#BeforePageLoadEvent event)

[回调型事件] 页面加载前事件

Parameters

$UI/system/lib/portal/shell#BeforePageLoadEvent event


结构如下:

{ data:加载参数, cancel:false }

Return Value

void

public void onPageActive ($UI/system/lib/portal/shell#PageActiveEvent event)

[回调型事件]页面激活事件

Parameters

$UI/system/lib/portal/shell#PageActiveEvent event


结构如下:

{ "data":{ xid:xid, params:eventParams, container:compose, isFirst:isFirst } }

Return Value

void

public void onPageInactive ($UI/system/lib/portal/shell#PageInactiveEvent event)

[回调型事件]页面非激活事件

Parameters

$UI/system/lib/portal/shell#PageInactiveEvent event


结构如下:

{ data:{ xid:xid, params:eventParams, container:compose } }

Return Value

void

public void onPageViewLoad ($UI/system/lib/portal/shell#PageViewLoadEvent event)

[回调型事件]功能view部分加载后事件

Parameters

$UI/system/lib/portal/shell#PageViewLoadEvent event


结构如下:

{ "data" : 打开page的参数 }

Return Value

void