3

我试图在加载窗口后立即显示 ModalDialog,类似于我的应用程序的许可协议。当点击按钮触发时它似乎工作正常,但当我尝试这个时不起作用:

这是在我的 VFlexBox 类型的组件数组中:

{ name: "theDialog", kind: "ModalDialog", components: [
    { content: "This is a Dialog Box" },
    { layoutKind: "HFlexLayout", pack: "center", components: [
    { name: "okayButton", kind: "Button", caption: "Okay" },
    { name: "closeButton", kind: "Button", caption: "Close" }
    ]}
]}

这就是我试图显示对话框的地方。

create: function() {
   this.inherited(arguments);
   this.$.theDialog.openAtCenter();
}

如果我放置了 this.$.theDialog.openAtCenter(); 在按钮的 onclick 事件的处理程序中,它工作得非常好。

4

1 回答 1

5

您是否尝试过放置 this.$.theDialog.openAtCenter(); 在 render() 里面

像这样的东西:

rendered: function() {
     this.$.theDialog.openAtCenter();
}

由于类型是“控制”,因此应在创建 UI 元素时调用渲染,因此应调用 openAtCenter。

于 2011-09-01T15:43:36.997 回答