Browse Source

Pull request #2111: 无JIAR任务 整理代码

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

* commit '3052c4d7628d1ff8f9ebf0ec9fe944b7aff207c7':
  整理代码
es6
guy 3 years ago
parent
commit
b5608075cb
  1. 40
      demo/app.js
  2. 16
      demo/js/center.js
  3. 7
      demo/js/main.store.js
  4. 2
      dist/router.js

40
demo/app.js

@ -10,26 +10,34 @@ BI.$(function () {
var tree = BI.Tree.transformToTreeFormat(Demo.CONFIG);
var routes = [{
path: '/',
component: function(){
path: "/",
component: function () {
return Promise.resolve({
type: "demo.face"
})
});
}
}];
BI.Tree.traversal(tree, function (index, node) {
if (!node.children || BI.isEmptyArray(node.children)) {
routes.push({
path: '/' + node.text,
component: function(){
return Promise.resolve({
type: node.value
})
}
}, {
name: "component",
path: "/component/:componentId",
component: function () {
return Promise.resolve({
type: "demo.router"
});
}
});
}];
// BI.Tree.traversal(tree, function (index, node) {
// if (!node.children || BI.isEmptyArray(node.children)) {
// routes.push({
// path: "/",
// component: function () {
// return Promise.resolve({
// type: node.value
// });
// }
// });
// }
// });
// var AppRouter = BI.inherit(BI.Router, obj);
// new AppRouter;
@ -49,7 +57,7 @@ BI.$(function () {
console.log(_ref);
ref = _ref;
}
}
};
}
});
});

16
demo/js/center.js

@ -9,4 +9,18 @@ Demo.Center = BI.inherit(BI.Widget, {
}
}
});
BI.shortcut("demo.center", Demo.Center);
BI.shortcut("demo.center", Demo.Center);
Demo.Router = BI.inherit(BI.Widget, {
props: {
baseCls: "demo-router"
},
render: function () {
var self = this;
var params = BI.Router.$router.history.current.params;
return {
type: params.componentId
}
}
});
BI.shortcut("demo.router", Demo.Router);

7
demo/js/main.store.js

@ -44,7 +44,12 @@
handleTreeSelectChange: function (v) {
var matched = BI.some(Demo.CONFIG, function (index, item) {
if (item.value === v) {
BI.Router.$router.push(item.text);
BI.Router.$router.push({
name: "component",
params: {
componentId: item.value
}
});
// BI.history.navigate(item.text, {trigger: true});
return true;
}

2
dist/router.js vendored

@ -3143,7 +3143,7 @@
created: function () {
var self = this, o = this.options;
cbs.push(this._callbackListener = function () {
self.tab.setSelect($router.history.current.matched[o.deps].path || "/");
self.tab.setSelect($router.history.current.fullPath || "/");
});
},
render: function () {

Loading…
Cancel
Save