@bpui/libs
Advanced tools
Comparing version 0.2.19 to 0.2.20
@@ -52,3 +52,3 @@ { | ||
"name": "@bpui/libs", | ||
"version": "0.2.19" | ||
"version": "0.2.20" | ||
} |
@@ -28,3 +28,3 @@ 'use strict'; | ||
if (navigator) { | ||
let vibrate = navigator.vibrate || | ||
let canVibrate = navigator.vibrate || | ||
navigator.webkitVibrate || | ||
@@ -34,4 +34,7 @@ navigator.mozVibrate || | ||
if(!vibrate && __debug) { | ||
console.log("vibrate not supported"); | ||
if (!canVibrate) { | ||
if (__debug) { | ||
console.log("vibrate not supported"); | ||
} | ||
return; | ||
} | ||
@@ -38,0 +41,0 @@ |
@@ -70,3 +70,3 @@ 'use strict'; | ||
location: bp.Location, | ||
onLoad:(component:any, onLoaded?:(component:any)=>void)=>void, | ||
onLoad:(component:{name: string, component: any}, onLoaded?:(component: {name?: string, component: any})=>void)=>void, | ||
onError:(err:Error)=>void | ||
@@ -85,5 +85,12 @@ ): Object { | ||
if (routes[j].path == noFileRouter) { | ||
if (routes[j].component) { | ||
onLoad(routes[j].component, (component)=>{ | ||
routes[j].component = component; | ||
if (routes[j].component||routes[j].name) { | ||
onLoad({ name: routes[j].name, component: routes[j].component }, (component) => { | ||
if (component) { | ||
if (component.component) { | ||
routes[j].component = component.component; | ||
} | ||
if (component.name) { | ||
routes[j].name = component.name; | ||
} | ||
} | ||
}); | ||
@@ -102,4 +109,8 @@ } | ||
if (window[GlobalRouter404]) { | ||
onLoad(window[GlobalRouter404], (component)=>{ | ||
window[GlobalRouter404] = component; | ||
onLoad({ component: window[GlobalRouter404], name: null }, (component) => { | ||
if (component) { | ||
if (component.component) { | ||
window[GlobalRouter404] = component.component; | ||
} | ||
} | ||
}); | ||
@@ -106,0 +117,0 @@ } |
@@ -146,3 +146,3 @@ 'use strict'; | ||
/** 加载完成. */ | ||
onLoad:(component:any, onLoaded?:(component:any)=>void)=>void, | ||
onLoad:(component:{name: string, component: any}, onLoaded?:(component: {name?: string, component: any})=>void)=>void, | ||
/** 匹配不到指定的路由组件. */ | ||
@@ -149,0 +149,0 @@ onError:(err:Error)=>void |
@@ -59,11 +59,14 @@ /** | ||
* 获得对应location的一个页面组件. (返回的是组件类, 而非创建出来的实例) | ||
* | ||
* @param onLoad 加载完成的回调. | ||
* - component: 加载完成的组件, 可能为组件对象或注册的组件唯一标识. | ||
* - onLoaded: 如果是异步加载,在生成完成时, 可以调用onLoaded将加载完成的组件回传, 下次加载时,将直接返回加载后的组件. | ||
* @param onError 匹配不到指定的路由组件的回调. | ||
*/ | ||
getMatchedComponent( | ||
location: Location, | ||
/** | ||
* 加载完成. | ||
* 如果是异步加载,在生成完成时, 可以调用onLoaded将加载完成的组件回传, 下次加载时,将直接返回加载后的组件. | ||
*/ | ||
onLoad:(component:any, onLoaded?:(component:any)=>void)=>void, | ||
/** 匹配不到指定的路由组件. */ | ||
onLoad: ( | ||
component: { name: string, component: any }, | ||
onLoaded?: (component: { name?: string, component: any }) => void | ||
) => void, | ||
onError:(err:Error)=>void | ||
@@ -70,0 +73,0 @@ ): void; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
2761428
25224