vue v-model常规案例
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
</head>
<body>
<div id="app">
<p>{{ message }}</p>
<!-- 点击label也可以选中 -->
<label v-for="item in buf">
<input type="checkbox" name="" id="" value="" :value="item" v-model="fruit" />{{item}}
</label>
<p>{{ fruit }}</p>
</div>
<script>
const app = new Vue({
el: '#app',
data: {
message: 'Hello Vue.js!',
buf: ['苹果', '桃', '香蕉', '葡萄'],
fruit: [],
},
})
</script>
</body>
</html>