美文网首页
2019-07-25vue中获得select中选中的值

2019-07-25vue中获得select中选中的值

作者: Kason晨 | 来源:发表于2019-07-25 15:33 被阅读0次

template:

<select v-model="selected" >
 <option v-for="option in options" v-bind:value="option.value">
   {{ option.text }}
 </option>
</select>
<span>Selected: {{ selected }}</span>

script:

 data: {
   selected: 'A',//select选中的值
   options: [
     { text: 'One', value: 'A' },
     { text: 'Two', value: 'B' },
     { text: 'Three', value: 'C' }
   ]
 }

选择就可以考到获取成功

相关文章

网友评论

      本文标题:2019-07-25vue中获得select中选中的值

      本文链接:https://www.haomeiwen.com/subject/sbphrctx.html