Blogger Information
Blog 250
fans 3
comment 0
visits 321669
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
Vue自学:input中的值绑定
梁凯达的博客
Original
2063 people have browsed it

<!DOCTYPE html>

<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.12"></script>
<title>Vue自学:input中的值绑定</title>
</head>
<body>
<div id="app">
<label v-for="item in fruits" v-bind:for="item">
<input type="checkbox" v-bind:id="item" v-bind:value="item" v-model="resArr" />{{item}}
</label>
<h3>你选择的包括:{{resArr}}</h3>
</div>
</body>
<script type="text/javascript">
const app = new Vue({
el:’#app’,
data:{
fruits:[
‘香蕉’,
‘苹果’,
‘雪梨’,
‘哈密瓜’,
‘西红柿’
],
resArr:[]
}
})
</script>
</html>

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post