diff --git a/changelog.md b/changelog.md index c44655889..48fe32596 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,6 @@ # 更新日志 2.0(2020-06) +- BI.history提供与注册路由对应的卸载路由方法unRoute - 修复了单选标红combo类setValue为空和空数组行为不一致的问题 - 单选列表支持新增选项 - 增加组件shortcut未定义的错误提示 diff --git a/src/router/router.js b/src/router/router.js index c180dc6ee..76504dffd 100644 --- a/src/router/router.js +++ b/src/router/router.js @@ -486,6 +486,16 @@ this.handlers.unshift({route: route, callback: callback}); }, + // remove a route match in routes + unRoute: function (route) { + var index = _.findIndex(this.handlers, function (handler) { + return handler.route.test(route); + }); + if (index > -1) { + this.handlers.splice(index, 1); + } + }, + // Checks the current URL to see if it has changed, and if it has, // calls `loadUrl`, normalizing across the hidden iframe. checkUrl: function (e) {