我正在创建一个非常简单的应用程序,并且正在使用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.

如何确定Onsen UI中的Dialog <ons-dialog>元素是否打开(可见)?

最佳答案

isShown()方法是Onsen UI v1的一部分。对于v2,您可以访问visible属性并获得相同的值。 Docs here

关于javascript - 温泉UI,如何使用isShow()方法,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/44854336/

10-12 07:26
查看更多