【问题标题】:Display ModalDialog on Enyo window load在 Enjo 窗口加载时显示模态对话框
【发布时间】:2011-09-01 04:05:01
【问题描述】:

我试图在加载窗口后立即显示 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();在 Button 的 onclick 事件的处理程序中,它工作得非常好。

【问题讨论】:

    标签: modal-dialog webos enyo


    【解决方案1】:

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

    类似这样的:

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

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

    【讨论】:

    • 效果很好。但是,我已经改变了我的应用程序的逻辑,所以它不再需要这样做了。不过我会记住的。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-12-10
    • 1970-01-01
    • 2011-05-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多