Fix select field value bind

This commit is contained in:
Alice Gaudon 2021-11-22 21:29:54 +01:00
parent e151c9c744
commit 6348692473

View File

@ -398,10 +398,10 @@
{/each} {/each}
</fieldset> </fieldset>
{:else if type === 'select'} {:else if type === 'select'}
<select name={name} id={fieldId} {...$$restProps} bind:this={input} on:input={handleInput}> <select name={name} id={fieldId} {...$$restProps} bind:this={input} bind:value={value} on:input={handleInput}>
{#each extraData as option} {#each extraData as option}
<option value={(option.display === undefined || option.value !== undefined) && (option.value || option)} <option value={(option.display === undefined || option.value !== undefined) && (option.value || option)}
selected={value === (option.value || option)}>{option.display || option}</option> >{option.display || option}</option>
{/each} {/each}
</select> </select>
<Icon name="chevron-down"/> <Icon name="chevron-down"/>