-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
43 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,22 @@ | ||
import type { Input as SelectInput } from "<ebay-select>" | ||
export type Input = SelectInput; | ||
class { | ||
onCreate() { | ||
this.state = { | ||
selected: null | ||
} | ||
} | ||
class {} | ||
handleChange({ index }) { | ||
this.state.selected = index; | ||
} | ||
} | ||
|
||
<span class="field"> | ||
<label class="field__label field__label--start" for="select"> | ||
Option | ||
</label> | ||
<ebay-select ...input name="formFieldName" id="select"> | ||
<@option value="1" text="Option 1"/> | ||
<@option value="2" text="Option 2"/> | ||
<@option value="3" text="Option 3"/> | ||
<ebay-select ...input name="formFieldName" id="select" on-change("handleChange")> | ||
<for|option, i| of=input.options> | ||
<@option value=option.value text=option.text selected=i === state.selected/> | ||
</for> | ||
</ebay-select> | ||
</span> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters