tsx:add ref and parent support

This commit is contained in:
pengfei.zhou
2021-09-02 11:39:51 +08:00
committed by osborn
parent c1f39de8e3
commit aeff0a06dc
13 changed files with 265 additions and 62 deletions

View File

@@ -1,4 +1,5 @@
import { Group, View } from "../ui/view";
import { layoutConfig } from "./layoutconfig";
import { ClassType } from "./types";
export const jsx = {
@@ -8,10 +9,9 @@ export const jsx = {
...children: View[]
): T {
const e = new constructor();
e.layoutConfig = layoutConfig().fit()
if (config) {
for (let key in config) {
Reflect.set(e, key, Reflect.get(config, key, config), e);
}
e.apply(config)
}
if (children && children.length > 0) {
if (e instanceof Group) {