Polymer 聚合物模块中的多个插入点?
在polymer中,我们可以像这样在自定义模块中使用Polymer 聚合物模块中的多个插入点?,polymer,web-component,shadow-dom,custom-element,html5-template,Polymer,Web Component,Shadow Dom,Custom Element,Html5 Template,在polymer中,我们可以像这样在自定义模块中使用为HTML内容创建插入点 <my-custom-element> Surrounding HTML ... <content></content> Surrounding HTML ... </my-custom-element> 周围的HTML。。。 周围的HTML。。。 然后以后使用如下模块: <my-custom-element>foo content</
为HTML内容创建插入点
<my-custom-element>
Surrounding HTML ...
<content></content>
Surrounding HTML ...
</my-custom-element>
周围的HTML。。。
周围的HTML。。。
然后以后使用如下模块:
<my-custom-element>foo content</my-custom-element>
foo内容
自定义元素能否支持多个基于
的插入点?如何选择?您可以使用
中的标准元素选择,使用
的选择属性和CSS选择器来获得不同的插入元素
<template>
Name : <content select="h2"></content><br>
Mail : <content select="#mail"></content>
</tempalte>
<my-custom-element>
<h2>Some One</h2>
<span id="mail">email@internet.com</span>
</my-custom-element>
名称:
邮寄:
某个人
email@internet.com
注意:在Polymer 2.0中,
将更改为
,行为保持不变@LeBird you's right元素在WhatWg/W3C规范中也被弃用。