鸿蒙代码回调
作者:
_菩提本无树_ | 来源:发表于
2024-06-26 15:57 被阅读0次@Entry
@Component
struct Parent {
@State cnt: number = 0
submit: () => void = () => {
this.cnt++;
}
build() {
Column() {
Text(`${this.cnt}`)
Son({ submitArrow: this.submit })
}
}
}
@Component
struct Son {
submitArrow?: () => void
build() {
Row() {
Button('add')
.width(80)
.onClick(() => {
if (this.submitArrow) {
this.submitArrow()
}
})
}
.justifyContent(FlexAlign.SpaceBetween)
.height(56)
}
}
本文标题:鸿蒙代码回调
本文链接:https://www.haomeiwen.com/subject/madscjtx.html
网友评论