tsx:add fragment support

This commit is contained in:
pengfei.zhou
2021-09-02 12:03:19 +08:00
committed by osborn
parent aeff0a06dc
commit 03633a7bea
11 changed files with 170 additions and 155 deletions

View File

@@ -5,31 +5,23 @@ import {
Gravity,
Group,
LayoutSpec,
Image,
Text,
makeRef,
} from "doric";
// class MyPanel extends Panel {
// build(root: Group) {
// <VLayout
// space={20}
// gravity={Gravity.Center}
// layoutConfig={{
// widthSpec: LayoutSpec.MOST,
// heightSpec: LayoutSpec.MOST,
// }}
// parent={root}
// >
// <Image imageUrl="https://doric.pub/logo.png" />
// <Text text="Hello,Doric" textSize={20} />
// </VLayout>;
// }
// }
function createFragment() {
return (
<>
<Text text="This is line 1 in fragment"></Text>
<Text text="This is line 2 in fragment"></Text>
</>
);
}
@Entry
class Counter extends Panel {
build(root: Group) {
const fragmnets = createFragment();
const ref = makeRef<Text>();
let count = 0;
<VLayout
@@ -50,6 +42,7 @@ class Counter extends Panel {
ref.current.text = `${count}`;
}}
/>
{fragmnets}
</VLayout>;
}
}