我有一个Aurelia自定义元素,我想要呈现一个表。它需要针对OData源控制分页等。我希望自定义元素的使用者提供行模板。我的元素的模板如下所示:
<template>
<div class="odata-table">
<div class="row">
<table>
<thead>
<tr>
<th repeat.for="column of columns">
${column.title}
</th>
</tr>
</thead>
<tbody>
<slot></slot>
</tbody>
</table>
</div>
</div>
</template>
然后当我使用它的时候:
<odata-table view-model.ref="resultsTable" url="http://localhost:5000/odata/v1/FooBar">
<tr repeat.for="record of resultsTable.records" slot="rows">
<td>${record.Foo}</td>
<td>${record.Bar}</td>
</tr>
</odata-table>
这些行永远不会出现在我的tbody中。如果我将槽移动到表之外,并将tr & td替换为ul & li,它会很好地呈现数据。
我需要做些什么来允许在一个表元素中有一个槽吗?
转载请注明出处:http://www.fulida88.com/article/20230526/1199806.html