简体   繁体   English

之间有什么区别 <content> 和 <shadow> 标记聚合物?

[英]What is the difference between <content> and <shadow> Tag in Polymer?

While reading the paper tabs component, I came to know that there is a tag <shadow></shadow> I tested it with one of my component. 在阅读纸制标签组件时,我知道有一个标记<shadow></shadow>我用其中一个组件对其进行了测试。 And it is working similar as <content></content> tag. 它的作用类似于<content></content>标记。 So my question is what is the difference between them? 所以我的问题是它们之间有什么区别?

In polymer, the shadow tag is use when you extend another polymer element , the parent template will be inserted inside the shadow tag. 在聚合物中,当您扩展另一个聚合物元素时 ,将使用阴影标签,父模板将插入到阴影标签内。 Whereas the local dom will be inserted inside the content tag 而本地dom将插入到内容标签中

They fulfill the same purpose of acting as an insertion point for content from outside the custom element and both are intended to being used on web component. 它们实现了充当自定义元素外部内容的插入点的相同目的,并且两者均旨在在Web组件上使用。

But where as <shadow> tag is used when you need to create more than one shadow root in a component. 但是,当您需要在组件中创建多个影子根目录时,可以使用<shadow>标记。

More about these tags at: 有关这些标签的更多信息,请访问:
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Shadow https://developer.mozilla.org/zh-CN/docs/Web/HTML/Element/Shadow
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/content https://developer.mozilla.org/zh-CN/docs/Web/HTML/Element/content

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM