Browse Source
Merge in VISUAL/fineui from ~GUY/fineui:master to master * commit 'e691b578d91d402e21019d267b16223cc00df08d': 新增h函数 新增h函数 新增h函数 新增h函数es6
guy
4 years ago
1 changed files with 35 additions and 0 deletions
@ -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…
Reference in new issue