jsx support use function as component
This commit is contained in:
20
doric-demo/src/FunctionalComponentDemo.tsx
Normal file
20
doric-demo/src/FunctionalComponentDemo.tsx
Normal 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>;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user