mirror of
https://gitee.com/openharmony/applications_app_samples
synced 2024-11-24 00:50:03 +00:00
修复弹窗闪退问题
Signed-off-by: 王鑫 <wangxin601@huawei.com>
This commit is contained in:
parent
d82b9778a9
commit
7b6baa68e9
@ -514,28 +514,34 @@ struct CustomDialogExample {
|
||||
@Component
|
||||
struct LookupFilterMenuItem {
|
||||
@State item: string = "";
|
||||
@State handlePopup: boolean = false
|
||||
|
||||
dialogController: CustomDialogController = new CustomDialogController({
|
||||
builder: CustomDialogDetails({
|
||||
item: $item
|
||||
}),
|
||||
offset: { dx: 0, dy: 220 },
|
||||
autoCancel: true,
|
||||
})
|
||||
|
||||
build() {
|
||||
MenuItem({ content: this.item })
|
||||
.bindPopup(this.handlePopup, {
|
||||
message: 'Filters:\n' + imageEffect.lookupFilters(this.item),
|
||||
messageOptions: {
|
||||
font: {
|
||||
size: '14vp',
|
||||
style: FontStyle.Italic
|
||||
},
|
||||
},
|
||||
placementOnTop: false,
|
||||
onStateChange: (e) => {
|
||||
console.log(e.isVisible.toString())
|
||||
if (!e.isVisible) {
|
||||
this.handlePopup = false
|
||||
}
|
||||
}
|
||||
})
|
||||
.onClick(() => {
|
||||
this.handlePopup = !this.handlePopup
|
||||
if (this.dialogController != null) {
|
||||
this.dialogController.open()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@CustomDialog
|
||||
struct CustomDialogDetails {
|
||||
@Link item: string
|
||||
controller?: CustomDialogController
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Text('Filters:\n' + imageEffect.lookupFilters(this.item))
|
||||
.fontSize(16)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user