具体代码
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
<title>el-checkbox的使用</title>
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.js"></script>
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
</head>
<body>
<div id="app">
<el-checkbox-group v-model="selTitles">
<el-checkbox class="titles" v-for='(allItem, allItemIndex) in allTitles' :label="allItem.value"
:key="allItem.value">{{allItem.lable}}</el-checkbox>
</el-checkbox-group>
</div>
<script>
new Vue({
el: '#app',
data() {
return {
allTitles: [{
value: 'status',
lable: '检查状态'
},
{
value: 'name',
lable: '姓名',
},
{
value: 'sex',
lable: '性别'
},
{
value: 'age',
lable: '年龄'
}
],
selTitles: ['status', 'name']
}
}
})
</script>
</body>
</html>