如何知道组件何时加载? [英] How to know when the component is loaded?
问题描述
当创建AngularDart组件时,我可以使用 ShadowRootAware
并覆盖 onShadowRoot
,以确保影子dom
When creating a AngularDart component, I can use ShadowRootAware
and override onShadowRoot
to be sure that the shadow dom is loaded and ready for manipulation, as described by the docs;
保证当调用[onShadowRoot]时,该影子DOM
已加载并准备就绪。
It is guaranteed that when [onShadowRoot] is invoked, that shadow DOM has been loaded and is ready.
但是,如果 useShadowDom
设置为false,我有什么替代方法保证组件或其内容被加载并准备好被操作?
However, if useShadowDom
is set to false, what alternative do I have that guarantees that the component or its content is loaded and ready to be manipulated?
推荐答案
您可以使用相同的方法。即使它说onShadowRoot它仍然触发,当它应该与阴影根禁用。我们刚刚在v0.12上试了一下。
You can use the same approach. Even though it says onShadowRoot it's still fired when it should with shadow root disabled. We just tried this last week on v0.12
这篇关于如何知道组件何时加载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!