当我已经在另一个模态中时尝试打开一个模态。我收到一条错误消息:
ViewHierarchy:父级已经在显示视图控制器之前,先显示视图控制器,然后再显示另一个!
这是一个游乐场样本,如何在一个模态中包含另一个模态?
重现
预期行为
您应该看到一个新的弹出窗口。
我的环境
$ tns info
✔ Getting NativeScript components versions information...
✔ Component nativescript has 6.5.0 version and is up to date.
✔ Component tns-core-modules has 6.5.0 version and is up to date.
✔ Component tns-android has 6.5.0 version and is up to date.
✔ Component tns-ios has 6.5.0 version and is up to date.
nativescript-vue文档尚不清楚如何使用嵌套模态,因为它是在@ yukashima-huksay发表后修复的。但是github上有一个示例演示了其用法。
可以使用target
选项打开辅助模态,该选项可以定位当前视图(带有this
)或元素(即this.$refs[<some element>]
)。
// this
this.$showModal(SecondaryModal, { target: this });
// $refs
this.$showModal(SecondaryModal, { target: this.$refs['myView'] });
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句