vue222/09-v-model双向绑定属性使用/v-model值绑定练习.html

29 lines
741 B
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div id="app">
<div v-for="item,index in fruit" style="display:inline-block;">
<input type="checkbox" :value="item" v-model="Chick_Fruit">{{item}}
</div>
你选择的水果有:<br>
<div v-for="fruits in Chick_Fruit">{{fruits}}</div>
</div>
</body>
<script src="../JavaScript/vue.min.js"></script>
<script>
const vue=new Vue({
el:"#app",
data:{
fruit:['苹果','香蕉','梨子','葡萄','桃子','山竹'],
Chick_Fruit:[]
}
})
</script>
</html>