Browse Source

Pull request #1905: 无JIRA任务新增h函数

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

* commit 'e691b578d91d402e21019d267b16223cc00df08d':
  新增h函数
  新增h函数
  新增h函数
  新增h函数
es6
guy 4 years ago
parent
commit
044a5a48dd
  1. 35
      src/core/h.js

35
src/core/h.js

@ -0,0 +1,35 @@
BI.Fragment = function () {
};
BI.h = function (type, props, children) {
if (children != null) {
if (!BI.isArray(children)) {
children = [children];
}
} else {
children = [];
}
if (arguments.length > 3) {
for (var i = 3; i < arguments.length; i++) {
if (BI.isArray(arguments[i])) {
children = children.concat(arguments[i]);
} else {
children.push(arguments[i]);
}
}
}
if (type === BI.Fragment) {
return children;
}
if (BI.isFunction(type)) {
type = type.xtype;
}
if (type === "el") {
return BI.extend({
el: children[0]
}, props);
}
return BI.extend({
type: type,
}, children.length > 0 ? {items: children} : {}, props);
};
Loading…
Cancel
Save