我有一个自定义的聚合物元素,其中包含一个项目的数组,使它们呈现为一个表格。我想添加一个处理表格中每一行渲染的自定义元素,但是在通常要添加<tr>
的位置,HTML中不允许使用自定义元素。对于Polymer自定义元素使用本地节点名称?
允许:
<table>
<tbody>
<tr>
<td>Example</td>
</tr>
</tbody>
</table>
不允许:
<table>
<tbody>
<custom-row>
<tr>
<td>Example</td>
</tr>
</custom-row>
</tbody>
</table>
我见过examples of Web Components that use an "is" attribute to extend native elements(例如<tr is="custom-row">
),但that doesn't seem to be possible in Polymer's template binding。
我解决此工作由两种渲染整个表在一个自定义元素,或使用div
S(与CSS为display:table
,display:table-row
,display:table-cell
等),而不是表/ TR/td元素。
是否可以继续使用<tr>
作为自定义元素的节点名称?
这工作,谢谢!我以为我曾尝试过'= =“'',但显然没有(或者没有正确地做过)。 –