<script>
let name = "Your Name"
let a = 40
let checked = true
let picked = "Two"
let names = ["Ace", "Blaze", "Chris", "Dwong"]
let checkedNames = []
let selectedName = []
</script>
<h1> 1. Text </h1>
Text<br/>
<input type="text" bind:value={name}/><br/>
Textarea <br/><textarea bind:value={name}/>
<h1> 2. Number</h1>
<input type=number bind:value={a} min="10" max="120"/>
<input type=range bind:value={a} min="10" max="120"/>
<h1>3. Checkbox</h1>
<h4> 3-1. Single</h4>
<label>
<input type="checkbox" bind:checked={checked}/> {checked ? "Checked" : "Not checked" }
</label>
<h4> 3-2. Array </h4>
{#each names as name, index (index)}
<label><input type="checkbox" value={name} bind:group={checkedNames}/> {name} </label>
{/each}
<h5> Checked: {checkedNames} </h5>
<h1>4. Radio button</h1>
<input type="radio" value="One" bind:group={picked}/> 1
<input type="radio" value="Two" bind:group={picked}/> 2
<input type="radio" value="Three" bind:group={picked}/> 3
<input type="radio" value="Four" bind:group={picked}/> 4
<h5>{picked}</h5>
<h1> 5. Selectbox</h1>
Selected option : {checkedNames}<br/>
<select bind:value={checkedNames} multiple>
{#each names as name} <option value={name}> {name} </option> {/each}
</select>
<br/>
<select bind:value={selectedName}>
{#each names as name} <option value={name}> {name} </option> {/each}
</select>
Selected option : {selectedName}
'생계유지형 개발자 > JS Framework' 카테고리의 다른 글
[Svelte] <svelte:self/> 컴포넌트 안에서 자신의 컴포넌트 호출하기 (JsonParser Sample) (0) | 2022.06.28 |
---|---|
[Svelte] Motion - tweened, spring example (0) | 2022.06.23 |
[svelte 기초] 자식 컴포넌트에서 부모 컴포넌트로 이벤트 발생시키기 (= Vue.$emit) (0) | 2022.06.15 |
[vue] <img src="[object Module]"> 이미지가 나오지 않을 때 (0) | 2021.08.05 |
scss 파일에서 url 오류날 때 (@import와 src 사용하기) (0) | 2021.07.22 |