Spread event handlers
bestguy opened this issue · comments
Looks like we don't support many props and event handlers unless specifically added to interface.
I need to catch up with Svelte 3 but doesn't look like it supports spread props ala React: {...props}
. May need to add them all individually, although this Svelte PR seems to add on:*
event support: sveltejs/svelte#3349
Looks like Svelte does support this, but difficult to optimize:
https://svelte.dev/docs#Attributes_and_props
Ex:
<Widget {...$$props}/>
Probably should use this for now on all components to ensure usage is correct, then can optimize after.
#40 is merged, should cover props.
Missing still is the various on:*
event handlers.
Renaming issue to just cover missing events
@bestguy what do you recommend as a work around I have an input type search
, after entering 3 letters I would like to run backend fetch. I was planning to use on:input
and see if the string/query size is >= 3.
Maybe changing Input
to input
is enough
Hi @telemmaite, I think I'll need to add support for the main events components use like on:click
, on:input
, etc. before Svelte supports on:*
I'll start a PR this weekend for components like Inputs and Buttons
Hi @telemmaite , actually this should work:
<script>
import { Input } from 'sveltestrap';
let name = 'world';
</script>
<Input bind:value={name} />
<h1>Hi {name}!</h1>
You don't need to use on:input
directly, although do plan to support passing event handlers.