Browse Source

Pull request #1908: BI-86090 history提供检测路由是否已存在的get方法

Merge in VISUAL/fineui from ~WINDY/fui:master to master

* commit 'f915fab6a80f52d8086f274dca574043cef93ead':
  BI-86090 history提供检测路由是否已存在的get方法
es6
windy 4 years ago
parent
commit
53478821f3
  1. 11
      src/router/router.js
  2. 2
      typescript/router/router.ts

11
src/router/router.js

@ -498,6 +498,17 @@
this.handlers.unshift({route: route, callback: callback});
},
// check route is Exist. if exist, return the route
checkRoute: function (route) {
for (var i = 0; i < this.handlers.length; i++) {
if (this.handlers[i].route.toString() === Router.prototype._routeToRegExp(route).toString()) {
return this.handlers[i];
}
}
return null;
},
// remove a route match in routes
unRoute: function (route) {
var index = _.findIndex(this.handlers, function (handler) {

2
typescript/router/router.ts

@ -26,6 +26,8 @@ export declare class History {
route(route: string, callback: Function): void;
checkRoute(route: string): { route: string, callback: Function};
unRoute(route: string): void;
checkUrl(e?: Event): void;

Loading…
Cancel
Save