This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
Doric/doric-cli/assets/$.ts

46 lines
1.3 KiB
TypeScript
Raw Permalink Normal View History

2021-12-08 11:38:05 +08:00
import { Panel, Group, vlayout, layoutConfig, Gravity, text, Text, Color, navbar, AssetsResource, image } from "doric";
2019-08-13 14:31:12 +08:00
@Entry
2019-11-27 20:14:09 +08:00
class __$__ extends Panel {
onShow() {
navbar(context).setTitle("__$__")
}
2019-11-27 20:14:09 +08:00
build(rootView: Group): void {
let number: Text
let count = 0
vlayout([
2021-12-08 11:38:05 +08:00
image({
image: new AssetsResource("logo_doric.png"),
}),
2019-11-27 20:14:09 +08:00
number = text({
textSize: 40,
text: '0',
}),
text({
text: "Click to count",
textSize: 20,
backgroundColor: Color.parse('#70a1ff'),
2019-11-27 20:14:09 +08:00
textColor: Color.WHITE,
onClick: () => {
number.text = `${++count}`
},
layoutConfig: layoutConfig().just(),
width: 200,
2019-11-27 20:14:09 +08:00
height: 50,
}),
])
.apply({
layoutConfig: layoutConfig().just().configAlignment(Gravity.Center),
2019-11-27 20:14:09 +08:00
width: 200,
height: 200,
space: 20,
border: {
color: Color.BLUE,
width: 1,
},
gravity: Gravity.Center,
})
2019-11-27 20:14:09 +08:00
.in(rootView)
2019-08-13 14:31:12 +08:00
}
}