guy 3 years ago
parent
commit
7ac0346a75
  1. 17
      src/router/router2.js

17
src/router/router2.js

@ -3125,7 +3125,6 @@
var $router, cbs = []; var $router, cbs = [];
var RouterWidget = BI.inherit(BI.Widget, { var RouterWidget = BI.inherit(BI.Widget, {
init: function () { init: function () {
this._routerRoot = this;
this._router = $router = new VueRouter({ this._router = $router = new VueRouter({
routes: this.options.routes routes: this.options.routes
}); });
@ -3138,14 +3137,17 @@
BI.shortcut("bi.router", RouterWidget); BI.shortcut("bi.router", RouterWidget);
var RouterView = BI.inherit(BI.Widget, { var RouterView = BI.inherit(BI.Widget, {
props: {
deps: 0
},
created: function () { created: function () {
var self = this; var self = this, o = this.options;
cbs.push(function () { cbs.push(this._callbackListener = function () {
self.tab.setSelect($router.history.current.matched[0].path || "/"); self.tab.setSelect($router.history.current.matched[o.deps].path || "/");
}); });
}, },
render: function () { render: function () {
var self = this; var self = this, o = this.options;
return { return {
type: "bi.tab", type: "bi.tab",
ref: function (_ref) { ref: function (_ref) {
@ -3157,9 +3159,12 @@
}, },
showIndex: false, showIndex: false,
cardCreator: function (v) { cardCreator: function (v) {
return $router.history.current.matched[0].components.default; return $router.history.current.matched[o.deps].components.default;
} }
}; };
},
destroyed: function () {
BI.remove(cbs, this._callbackListener);
} }
}); });
BI.shortcut("bi.router_view", RouterView); BI.shortcut("bi.router_view", RouterView);

Loading…
Cancel
Save