在Enyo窗口加载时显示ModalDialog

Bha*_*all 3 modal-dialog webos enyo

我试图在窗口加载后立即显示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" }
    ]}
]}
Run Code Online (Sandbox Code Playgroud)

这就是我试图展示对话框的地方.

create: function() {
   this.inherited(arguments);
   this.$.theDialog.openAtCenter();
}
Run Code Online (Sandbox Code Playgroud)

如果我放置了这个.$.theDialog.openAtCenter(); 在Button的onclick事件的处理程序内,它工作得非常好.

Viv*_*R K 5

你有没有试过这个.$.theDialog.openAtCenter(); 在render()内

像这样的东西:

rendered: function() {
     this.$.theDialog.openAtCenter();
}
Run Code Online (Sandbox Code Playgroud)

由于类型为"Control",因此在创建UI元素时应调用渲染,因此应调用openAtCenter.