嵌套的 Webcomponents 问题
Nested Webcomponents issue
我使用 webcomponents.js 和 Shadydom polyfills 来玩网络组件。
我的代码在 Github : https://github.com/olofweb/webcomponents-action-bar
第一个网络组件是 my-action-2
。这是一个带有标题的按钮。第二个网络组件是 my-action-bar
。目标是以编程方式将 my-action-2
添加到 my-action-bar
中。
为此,my-action-bar
有一个 addAction()
方法可以创建一个新的 my-action-2
元素并将其添加到影子 DOM.
问题在 my-action-2
、line 33。当my-action-2
嵌套在my-action-bar
中时,shadowRoot
变量表示my-action-bar
的影子DOM而不是my-action-2
!
它是重复的。
Github 如果有人感兴趣,项目已更新。
我使用 webcomponents.js 和 Shadydom polyfills 来玩网络组件。
我的代码在 Github : https://github.com/olofweb/webcomponents-action-bar
第一个网络组件是 my-action-2
。这是一个带有标题的按钮。第二个网络组件是 my-action-bar
。目标是以编程方式将 my-action-2
添加到 my-action-bar
中。
为此,my-action-bar
有一个 addAction()
方法可以创建一个新的 my-action-2
元素并将其添加到影子 DOM.
问题在 my-action-2
、line 33。当my-action-2
嵌套在my-action-bar
中时,shadowRoot
变量表示my-action-bar
的影子DOM而不是my-action-2
!
它是重复的。
Github 如果有人感兴趣,项目已更新。