doric-cli add createLib
This commit is contained in:
41
doric-cli/assets-lib/example/src/Example.ts
Normal file
41
doric-cli/assets-lib/example/src/Example.ts
Normal 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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user