@CustomDialog
struct CustomDialogExample {
@State sign: number = 140
controller: CustomDialogController = new CustomDialogController({
builder: CustomDialogExample(),
})
aa: () => void = () => {
}
build() {
Column() {
Text('我是内容')
.fontSize(20)
.margin({ top: 10, bottom: 10 })
Button('dian').onClick(() => {
this.sign = 300
})
Button('dian').onClick(() => {
this.sign = 140
})
}.height(this.sign).backgroundColor('#ff23f60e')
}
}
@Entry
@Component
struct CustomDialogUser {
dialogController: CustomDialogController = new CustomDialogController({
alignment: DialogAlignment.Bottom,
offset: { dx: 0, dy: -20 },
builder: CustomDialogExample({
aa: () => {
this.aa()
}
}),
})
aa() {
console.log('1212121')
}
build() {
Column() {
Button('click me')
.onClick(() => {
this.dialogController.open()
})
}.width('100%').margin({ top: 5 })
}
}
【无标题】
最新推荐文章于 2024-09-15 23:59:26 发布