diff --git a/changelog.md b/changelog.md index c44655889e..48fe325965 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 c180dc6eea..76504dffd7 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) {