什么元素是可插入的?
What element is slotable?
我可以为命名插槽使用 tr(table 行)吗?
当我使用 tr 作为插槽后备内容时会发生什么?
像这样:
<x-table>
<tr slot="x-row">
<td>data</td>
<td>data</td>
</tr>
</x-table>
codepen 中的示例代码 https://codepen.io/JJia/pen/odXrWJ
一个<tr>
个元素必须有一个parent among <thead>
, <tbody>
, <tfoot>
or <table>
个元素。
遗憾的是,这些元素无法支持阴影 DOM。查看 elements with the attachShadow()
method.
的列表
因此,他们的一级子级(即 <tr>
)不能与 slot
属性一起使用。
我可以为命名插槽使用 tr(table 行)吗? 当我使用 tr 作为插槽后备内容时会发生什么?
像这样:
<x-table>
<tr slot="x-row">
<td>data</td>
<td>data</td>
</tr>
</x-table>
codepen 中的示例代码 https://codepen.io/JJia/pen/odXrWJ
一个<tr>
个元素必须有一个parent among <thead>
, <tbody>
, <tfoot>
or <table>
个元素。
遗憾的是,这些元素无法支持阴影 DOM。查看 elements with the attachShadow()
method.
因此,他们的一级子级(即 <tr>
)不能与 slot
属性一起使用。