Browse Source

Pull request #2299: KERNEL-8279 feat:嵌套路由可以渲染到子层级

Merge in VISUAL/fineui from ~GUYI/fineui:master to master

* commit 'c71ea4c6bc595a0efebb54feae7c3d56468748c3':
  KERNEL-8279  feat:嵌套路由可以渲染到子层级
es6
Guyi 3 years ago
parent
commit
9ffcc6d2cc
  1. 26
      demo/app.js
  2. 3
      dist/router.js

26
demo/app.js

@ -40,7 +40,7 @@ BI.$(function () {
height: 100 height: 100
}, { }, {
type: "bi.router_view", type: "bi.router_view",
name: 'home', name: 'tool-buttons',
deps: 1 deps: 1
}] }]
}); });
@ -49,12 +49,6 @@ BI.$(function () {
path: '', path: '',
components: { components: {
default: function () { default: function () {
return Promise.resolve({
type: "bi.label",
text: 'default'
});
},
home: function () {
return Promise.resolve({ return Promise.resolve({
type: "bi.label", type: "bi.label",
text: 'home' text: 'home'
@ -73,11 +67,19 @@ BI.$(function () {
}, { }, {
name: 'tables', name: 'tables',
path: 'tables/:id', path: 'tables/:id',
component: function () { components: {
return Promise.resolve({ default: function () {
type: "bi.label", return Promise.resolve({
text: 'tables' type: "bi.label",
}); text: 'table-view'
});
},
"tool-buttons": function () {
return Promise.resolve({
type: "bi.label",
text: '预览按钮',
});
},
} }
}] }]
}]; }];

3
dist/router.js vendored

@ -3147,6 +3147,7 @@
BI.RouterView = BI.inherit(BI.Widget, { BI.RouterView = BI.inherit(BI.Widget, {
props: { props: {
baseCls: 'bi-router-view',
deps: 0, deps: 0,
name: 'default' name: 'default'
}, },
@ -3168,6 +3169,8 @@
self.tab.setSelect(matchedPath || "/"); self.tab.setSelect(matchedPath || "/");
} }
}); });
// "bi.router_view"是由"bi.tab"实现的,cardCreator是一个异步过程,在"bi.router_view"创建之前,cbs里不会有创建子组件的方法,在初始化路由时,没法直接渲染到子组件,所以这里手动加了一次调用
this._callbackListener();
}, },
render: function () { render: function () {
var self = this, o = this.options; var self = this, o = this.options;

Loading…
Cancel
Save