-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Closed
Description
I'm learning Vue by working through the 2.0 guide, so this is likely my mistake.
When I try to implement the Form Input Bindings - Value Bindings - Select Options example as below, I get vm.selected === undefined whenever I select any option (also, the first option, 123, always appears "checked" in the dropdown).
I'm using Vue.js v2.0.0-rc.5
My code is here: https://github.com/jvanbrug/vue-guide-examples/tree/master/08_Form_Input_Bindings/02_Value_Bindings
The live demo of that code is here: https://jvanbrug.github.io/vue-guide-examples/08_Form_Input_Bindings/02_Value_Bindings/index.html
Thanks for Vue, Vuejs.org, and any help with this! 😃
index.html
<body>
<div class="content">
...
<div id="example-select" class="demo">
<select v-model="selected">
<option v-bind:value="{ number: 123 }">123</option>
<option v-bind:value="{ number: 456 }">456</option>
<option v-bind:value="{ number: 789 }">789</option>
</select>
<div>
Selected type: {{ typeof selected }}
</div>
<div>
Selected number: {{ typeof selected === 'object' ? selected.number : 'N/A' }}
</div>
</div>
...
</div>
<script src="../../vue.js"></script>
<script src="./main.js"></script>
</body>main.js
...
var vm = new Vue({
el: '#example-select',
data: {
selected: undefined
}
})Metadata
Metadata
Assignees
Labels
No labels