【发布时间】:2020-05-10 16:29:59
【问题描述】:
我正在从 Nativescript-Vue 函数打开一个模态组件,该函数可以正常打开
this.$showModal(SuccessModal).then(() => { console.log('Modal Closed') });
我可以从模态框内的按钮调用$modal.close,但如果我尝试从mounted() 挂钩调用它,则会得到$modal is undefined。
我希望模态框在三秒超时后自行关闭,而不是用户必须在模态框外单击。
我该怎么办?
【问题讨论】:
-
我无法重现这个问题,你能设置一个最小的 Playground 示例吗?
-
@Manoj play.nativescript.org/?template=play-vue&id=cipUop&v=3 这显示了一个基本的模式,那么我将在哪里/如何在设定的时间后自动关闭模式,而不必触摸屏幕?
-
我在您的示例中没有看到任何与
$modal.close相关的代码,请分享完整的示例,以便重现问题。 -
我更新了 Playground 以显示
$modal.close返回未定义。
标签: nativescript nativescript-vue