jsx support use function as component

This commit is contained in:
pengfei.zhou
2022-07-04 14:13:41 +08:00
committed by osborn
parent 6cafcbc688
commit 35c6d03d14
18 changed files with 2934 additions and 4714 deletions

View File

@@ -0,0 +1,20 @@
import { Text, Group, Panel, jsx, VLayout, layoutConfig, HLayout } from "doric";
function CellItem(props: { text: string }) {
return (
<HLayout layoutConfig={layoutConfig().mostWidth().justHeight()} height={50}>
<Text>{props.text}</Text>
</HLayout>
);
}
@Entry
class FunctionalComponentDemo extends Panel {
build(root: Group) {
<VLayout layoutConfig={layoutConfig().most()} parent={root}>
<CellItem text="Cell0"></CellItem>
<CellItem text="Cell1"></CellItem>
<CellItem text="Cell2"></CellItem>
</VLayout>;
}
}