首页 > 编程 > JavaScript > 正文

vue.js 获取select中的value实例

2019-11-19 14:15:35
字体:
来源:转载
供稿:网友

如下所示:

<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>Document</title><script type="text/javascript" src="./vue.js"></script></head><body><label id="app"><select v-model="selected" > <option v-for="option in options" v-bind:value="option.value"> {{ option.text }} </option></select><span>Selected: {{ selected }}</span></label><script>new Vue({ el: '#app', data: { selected: 'A', options: [  { text: 'One', value: 'A' },  { text: 'Two', value: 'B' },  { text: 'Three', value: 'C' } ] }})</script></body></html>

以上这篇vue.js 获取select中的value实例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持武林网。

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表