You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to componentize a data table in my project and I wanted to include custom features that
are not just ordinary text but with the likes of menu icon, buttons, delete icon etc. For reusability it has to be
dynamic using named slots.
Describe the problem
I was trying to componentize a data table in my project and I wanted to include custom features that
are not just ordinary text but with the likes of menu icon, buttons, delete icon etc. For reusability it has to be
dynamic using named slots.
The REPL link is:
https://svelte.dev/repl/4bdd5fc5f12a41fc8ec51129c8015be4?version=3.44.2
This code sample is shown below:
Table.svelte COMPONENT
<script> let headers = [{name:"usa", value:"text"},{slot: true, name:"canada", value:"num"},]; let data= [{text:"one", num:1},{text:"two", num:2},{text:"three", num:3},] </script> {#each headers as item} {/each} {#each data as row,i (i)} {#each headers as item} {#if item.slot} {:else} {/if} {/each} {/each}App.svelte COMPONENT
<script> import Table from './Table.svelte'; </script> {payload.num}Describe the proposed solution
I would like the dynamic slot name to be enabled like :
Alternatives considered
For now, I have to declare the name explicitly which makes it not dynamic again.
Importance
would make my life easier
The text was updated successfully, but these errors were encountered: