From fcb76d33b40f1dfc13ac91d8ed65236051fa204b Mon Sep 17 00:00:00 2001 From: guy Date: Sat, 8 May 2021 22:04:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Eh=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/h.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/core/h.js diff --git a/src/core/h.js b/src/core/h.js new file mode 100644 index 0000000000..a8bf3e29dd --- /dev/null +++ b/src/core/h.js @@ -0,0 +1,19 @@ +BI.Fragment = function () { +}; + +BI.h = function (type, props, children) { + 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({ + items: children + }, props); +}; \ No newline at end of file