How can I forward event from a custom Listbox component on v2.0? #155
Unanswered
shamscorner
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Since the
on:changeevent is removed from theListboxcomponent, I am not sure how can I forward it to it's parent from child. Here is my implementation:Consider this
FormSelect.sveltefile:Note: consider the script tag is there and also some other implementations.
export let options: { option: string; value: string }[]; export let value: (typeof options)[number] | null | undefined = null; const dispatch = createEventDispatcher(); $: { dispatch('change', value); } <Listbox bind:value let:open class={wrapClass}> .... </Listbox>On another file:
Now the problem is: if I have 3
FormSelectcomponents, all are forwarding that change-event even if I don't attachon:changeon the other components. My guess is it is binding the value to the ListBox by reference somehow and it is updating for all components that means thatonChangePackageTypemethod is calling for all the otherFormSelectcomponents.Any suggestions would be much appreciated.
Beta Was this translation helpful? Give feedback.
All reactions