在Enyo窗口加载时显示模态对话框。

3
我将尝试在窗口加载时显示一个模态对话框,就像我的应用程序的许可协议。 当通过按钮单击触发时,它似乎运行良好,但是当我尝试以下操作时,它无法正常工作:
这是我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事件处理程序中,它就能完美运行。

1个回答

5

你尝试将this.$.theDialog.openAtCenter()放在rendered()函数内吗?

像这样:

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

由于类型为“Control”,因此应在创建UI元素时调用渲染函数,因此应调用openAtCenter。


那个很好地运作了。不过,我已经改变了我的应用程序逻辑,所以它不再需要这样做了。不过我会记住这个的。 - Bhakta Nall

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接