34 lines
677 B
Plaintext
34 lines
677 B
Plaintext
@Component
|
|
export struct RuntimeToolbar {
|
|
onBack?: () => void
|
|
onRestart?: () => void
|
|
onExit?: () => void
|
|
@Prop canRestart: boolean = true
|
|
@Prop canExit: boolean = true
|
|
|
|
build() {
|
|
Row({ space: 12 }) {
|
|
Button('返回').onClick(() => {
|
|
if (this.onBack) {
|
|
this.onBack()
|
|
}
|
|
})
|
|
Button('重启')
|
|
.enabled(this.canRestart)
|
|
.onClick(() => {
|
|
if (this.onRestart) {
|
|
this.onRestart()
|
|
}
|
|
})
|
|
Button('退出')
|
|
.enabled(this.canExit)
|
|
.onClick(() => {
|
|
if (this.onExit) {
|
|
this.onExit()
|
|
}
|
|
})
|
|
}
|
|
.padding(16)
|
|
}
|
|
}
|