new CtMobile(config)
Parameters:
Name | Type | Description |
---|---|---|
config |
Object | config { supportCordova: [true | false],是否支持cordova,默认为false linkCaptureReload: [true | false],标签加载页面是否改变浏览器历史,默认为true router: Object { id (ct-data-role="page"的id属性): Object{ component: Function (返回一个Prmise) config: Object { transition: {string} - 过度类型 mode: {string} - 启动类型 intentfilterAction: {string} - 通知的actioon intentfilterCategorys: {string} - 通知的categorys intentfilterPriority: {string} - 通知的proirity } } } } |
- Source:
Methods
back()
返回
- Source:
createPage(id, callback) → {Page}
通过ID创建Page对象
Parameters:
Name | Type | Description |
---|---|---|
id |
string | |
callback |
function |
- Source:
Returns:
- Type
- Page
executeReceiverById(id, jsonStr)
执行Receiver通过Id
Parameters:
Name | Type | Description |
---|---|---|
id |
string | |
jsonStr |
string |
- Source:
fireEvent(dom, type, params)
触发一个自定义事件
Parameters:
Name | Type | Description |
---|---|---|
dom |
HtmlElement | |
type |
string | |
params |
Object |
- Source:
getFirstId() → {string}
获取第一页真正的ID
- Source:
Returns:
- Type
- string
getFirstPage() → {Page}
获取历史记录中的栈第一个元素
- Source:
Returns:
- Type
- Page
getFirstPageId() → {string}
获取第一个页面的pageId
- Source:
Returns:
- Type
- string
getHistoryLength() → {number}
获取历史栈长度
- Source:
Returns:
- Type
- number
getId(pageId) → {string}
根据模板page的ID获取真正page的ID
注释:pageId_时间戳?parameters
Parameters:
Name | Type | Description |
---|---|---|
pageId |
string |
- Source:
Returns:
- Type
- string
getLastPage() → {Page}
获取历史记录中的栈顶的元素
- Source:
Returns:
- Type
- Page
getPageById(id) → {Page}
根据ID获取page对象
Parameters:
Name | Type | Description |
---|---|---|
id |
string |
- Source:
Returns:
- Type
- Page
getPageByIndex(index) → {Page}
根据索引获取page对象
Parameters:
Name | Type | Description |
---|---|---|
index |
string |
- Source:
Returns:
- Type
- Page
getPageConfigAttribute(pageId, property) → {string}
获取Page的配置信息
Parameters:
Name | Type | Description |
---|---|---|
pageId |
string | pageId |
property |
string | property |
- Source:
Returns:
transition: {string} - 过度类型
mode: {string} - 启动类型
intentfilterAction: {string} - 通知的actioon
intentfilterCategorys: {string} - 通知的categorys
intentfilterPriority: {string} - 通知的proirity
- Type
- string
getPageIdByHash() → {string}
通过hash值获取pageId
例子: "#info_1541214530597?id=1"
- Source:
Returns:
- Type
- string
getParameter() → {Object}
获取转场的参数
- Source:
Returns:
- Type
- Object
getParameterByHash() → {string}
通过hash获取参数Parameter
- Source:
Returns:
- Type
- string
getRequest(page) → {Object}
获取父窗体的setRequest的值
Parameters:
Name | Type | Description |
---|---|---|
page |
Page |
- Source:
Returns:
- Type
- Object
getSingleInstance(pageId) → {Page}
根据pageId获取单例对象
Parameters:
Name | Type | Description |
---|---|---|
pageId |
string |
- Source:
Returns:
- Type
- Page
indexOfById(id) → {number}
根据id获取索引
Parameters:
Name | Type | Description |
---|---|---|
id |
string |
- Source:
Returns:
- Type
- number
registerReceiver()
注册Receiver对象
- Source:
sendBroadcast(intent)
发送无序广播
Parameters:
Name | Type | Description |
---|---|---|
intent |
Object | { action:[string] action categorys:[array] 分类 bundle:Object 参数 } |
- Source:
sendOrderedBroadcast(intent)
发送有序广播
Parameters:
Name | Type | Description |
---|---|---|
intent |
Object | { action:[string] action categorys:[array] 分类 bundle:Object 参数 } |
- Source:
startPage(href, option)
页面跳转
Parameters:
Name | Type | Description |
---|---|---|
href |
string | (pageId = pageId + params) 如: page1?a=1&b=2; |
option |
Object | { reload : [true | false] } |
- Source:
unregisterReceiver()
解除注册Receiver对象
- Source:
unregisterReceiverByDom(el)
解除注册通过Page中的Dom
Parameters:
Name | Type | Description |
---|---|---|
el |
HtmlElement |
- Source: