【发布时间】:2021-05-27 21:32:12
【问题描述】:
我有一个 Table 组件,它有一个带有回退的单元格槽:
<!-- .... -->
<slot name="cell" {column} {columnIndex}>
<div style="color: green">
{column} : { cells[columnIndex] }
</div>
</slot>
<!-- .... -->
当使用表格组件时,我想只为一列索引覆盖插槽内容:
<Table columns={['a', 'b', 'c']} cells={[1, 2, 3]}>
<div slot="cell" let:columnIndex>
{#if columnIndex == 2 }
3333
{:else }
HOW TO CALL FALLBACK OF TABLE?
{/if}
</div>
</Table>
如何从 Table 组件调用单元格槽后备?
https://svelte.dev/repl/0e455d61f1db442c99a5320ce85df041?version=3.32.3
【问题讨论】:
标签: svelte-3