28 lines
452 B
Markdown
28 lines
452 B
Markdown
|
## v-model
|
||
|
|
||
|
```html
|
||
|
<div id="example-6">
|
||
|
<select v-model="selected">
|
||
|
<option v-for="option in options" v-bind:value="option.value">
|
||
|
{{ option.text }}
|
||
|
</option>
|
||
|
</select>
|
||
|
<span>Selected: {{ selected }}</span>
|
||
|
</div>
|
||
|
```
|
||
|
|
||
|
```js
|
||
|
new Vue({
|
||
|
el: 'example-6',
|
||
|
data: {
|
||
|
selected: 'A',
|
||
|
options: [
|
||
|
{ text: 'One', value: 'A' },
|
||
|
{ text: 'Two', value: 'B' },
|
||
|
{ text: 'Three', value: 'C' }
|
||
|
]
|
||
|
}
|
||
|
})
|
||
|
```
|
||
|
|