doric-cli add createLib

This commit is contained in:
pengfei.zhou
2021-08-04 15:32:19 +08:00
parent 7a8fe598cd
commit 9cb8df5372
78 changed files with 2188 additions and 44 deletions

View File

@@ -0,0 +1,41 @@
import {
Panel,
Group,
vlayout,
layoutConfig,
Gravity,
text,
Color,
navbar,
modal,
} from "doric";
import { demoPlugin } from "__$__";
@Entry
class Example extends Panel {
onShow() {
navbar(context).setTitle("Example");
}
build(rootView: Group) {
vlayout([
text({
text: "Click to call native plugin",
textSize: 20,
backgroundColor: Color.parse("#70a1ff"),
textColor: Color.WHITE,
onClick: async () => {
const result = await demoPlugin(this.context).call();
await modal(this.context).alert(result);
},
layoutConfig: layoutConfig().fit(),
padding: { left: 20, right: 20, top: 20, bottom: 20 },
}),
])
.apply({
layoutConfig: layoutConfig().fit().configAlignment(Gravity.Center),
space: 20,
gravity: Gravity.Center,
})
.in(rootView);
}
}