From cf2875b9e7059998468c5bf861ee01cbf7934da0 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Wed, 10 Jun 2020 19:16:26 +0800 Subject: [PATCH] =?UTF-8?q?BI-66406=20refactor:=20BI.history=E6=8F=90?= =?UTF-8?q?=E4=BE=9B=E4=B8=8E=E6=B3=A8=E5=86=8C=E8=B7=AF=E5=BE=84=E5=AF=B9?= =?UTF-8?q?=E5=BA=94=E7=9A=84=E5=8D=B8=E8=BD=BD=E8=B7=AF=E5=BE=84=E7=9A=84?= =?UTF-8?q?=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- changelog.md | 1 + src/router/router.js | 10 ++++++++++ 2 files changed, 11 insertions(+) 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) {