PopoverDialog问题修改

Signed-off-by: zWX1284381 <zhaobinbin8@h-partners.com>
This commit is contained in:
zWX1284381 2024-09-10 11:35:18 +08:00
parent 9e9cf9c4c6
commit 65bc061eec
2 changed files with 21 additions and 2 deletions

View File

@ -4048,7 +4048,7 @@ export class PopoverDialog extends ViewPU {
this.__visible = new SynchedPropertySimpleTwoWayPU(o.visible, this, 'visible');
this.__popover = new SynchedPropertyObjectOneWayPU(o.popover, this, 'popover');
this.targetBuilder = undefined;
this.__dialogWidth = new ObservedPropertyObjectPU(this.popover.width, this, 'dialogWidth');
this.__dialogWidth = new ObservedPropertyObjectPU(this.popover?.width, this, 'dialogWidth');
this.setInitiallyProvidedValue(o);
this.finalizeConstruction();
}
@ -4104,6 +4104,15 @@ export class PopoverDialog extends ViewPU {
this.__dialogWidth.set(h);
}
emptyBuilder(n = null) {
}
aboutToAppear() {
if (this.targetBuilder === undefined || this.targetBuilder === null) {
this.targetBuilder = this.emptyBuilder;
}
}
initialRender() {
PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.push(this);
this.observeComponentCreation2((b, c) => {

View File

@ -1643,7 +1643,17 @@ export struct PopoverDialog {
@Link visible: boolean;
@Prop popover: PopoverOptions;
@BuilderParam targetBuilder: Callback<void>;
@State dialogWidth: Dimension | undefined = this.popover.width;
@State dialogWidth: Dimension | undefined = this.popover?.width;
@Builder
emptyBuilder() {
}
aboutToAppear(): void {
if (this.targetBuilder === undefined || this.targetBuilder === null) {
this.targetBuilder = this.emptyBuilder;
}
}
build() {
Column() {