vue.js多选列表(绑定到一个数组)

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>vue.js Hello World!</title>
<script type="text/javascript" src="https://cdn.bootcss.com/vue/2.2.2/vue.min.js"></script>
</head>
<body>
<div id="example-6">
<select v-model="selected" multiple style="width: 50px">
<option>A</option>
<option>B</option>
<option>C</option>
</select>
<br>
<span>Selected: {{ selected }}</span>
</div>
<script type="text/javascript">
new Vue({
el: '#example-6',
data: {
selected: []
}
})
</script>
</body>
</html>

posted on 2017-07-13 19:52  醉半仙  阅读(567)  评论(0编辑  收藏  举报

导航