我正在创建一个非常简单的应用程序,我使用的是 Onsen UI 和纯 JavaScript(没有 Angular、React 或 Vue)。这是第一次使用这个框架,但到目前为止看起来非常简单直接,除了isShow()
方法。我有一个对话框,我使用以下方法打开:
document.getElementById(id).show({ animation: "fade" });
但现在我需要知道如何检查对话框是否打开。我认为使用这样的东西会起作用:
console.log(document.getElementById(id).isShown());
但是我收到一条document.getElementById(...).isShown is not a function
错误消息。我唯一能找到的是 Onsen UI 文档中所说的内容:isShown() Returns whether the popover is visible or not.
如何确定 Dialog<ons-dialog>
元素在 Onsen UI 中是否打开(可见)?