65 lines
1.7 KiB
Plaintext
65 lines
1.7 KiB
Plaintext
|
|
@CustomDialog
|
|
export struct TripleOptionDialog {
|
|
controller: CustomDialogController; // 必须包含的控制器属性
|
|
@Prop title: string = ''
|
|
@Prop subTitle:string = ''
|
|
@Prop oneButtonTitle:string = ''
|
|
@Prop twoButtonTitle:string = ''
|
|
|
|
private buttonSelected: (actionType:string) => void = () => {};
|
|
|
|
// 按钮点击事件处理
|
|
private handleAction(actionType: string) {
|
|
this.buttonSelected(actionType)
|
|
this.controller.close(); // 关闭弹窗
|
|
}
|
|
|
|
build() {
|
|
Column() {
|
|
Text(this.title)
|
|
.fontSize(20)
|
|
.fontWeight(FontWeight.Bold)
|
|
.margin({ top: 20 })
|
|
if (this.subTitle.length) {
|
|
Text(this.subTitle)
|
|
.fontSize(15)
|
|
.padding({top:5})
|
|
}
|
|
Column() {
|
|
Blank()
|
|
.width('100%')
|
|
.height(1)
|
|
.backgroundColor('#f4f4f4')
|
|
Text(this.oneButtonTitle)
|
|
.height(40)
|
|
.fontSize(14)
|
|
.fontColor('#333333')
|
|
.onClick(() => this.handleAction(this.oneButtonTitle))
|
|
Blank()
|
|
.width('100%')
|
|
.height(1)
|
|
.backgroundColor('#f4f4f4')
|
|
Text(this.twoButtonTitle)
|
|
.height(40)
|
|
.fontSize(14)
|
|
.fontColor('#333333')
|
|
.onClick(() => this.handleAction(this.twoButtonTitle))
|
|
Blank()
|
|
.width('100%')
|
|
.height(1)
|
|
.backgroundColor('#f4f4f4')
|
|
Text('取消')
|
|
.height(40)
|
|
.fontSize(14)
|
|
.fontColor('#999999')
|
|
.onClick(() => this.controller.close())
|
|
}
|
|
.width('100%')
|
|
.margin({ top:20,bottom: 20 })
|
|
}
|
|
.backgroundColor(Color.Transparent)
|
|
.borderRadius(16)
|
|
.width('100%')
|
|
}
|
|
} |