项目目录介绍
ArkTS介绍
简单案例:
@State times: number = 0
@State msg: string = "hello"
@State a: any = "hello"
build() {
Row() {
Column() {
Button(`点我${this.times}次`).backgroundColor("#360").onClick(() => {
this.times++
}).width('100%')
Text(this.msg)
.fontSize(50)
.fontColor('#360')
.fontFamily("华文行楷")
.fontWeight(FontWeight.Bold)
.onClick(() => {
// 处理事件
this.msg = '改变了'
})
Image($r('app.media.mate60')).width(250)
}.width('100%')
}
.justifyContent(FlexAlign.Center)
.height('100%')
}
运行示例: