<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="vue.js"></script>
</head>
<body>
<div id="app">
<my-check-box v-model="active"></my-check-box>
<div v-show="active">
如果选择框打勾我就会显示。
</div>
</div>
<script>
let myCheckBox = {
template: `<p><input type="checkbox" :checked="checked" @change="$emit('change', $event.target.checked)"></p>`,
model:{
props: ['checked'],
event:'change'
},
props:{
checked:Boolean
}
}
let app = new Vue({
el: '#app',
data: {
active:false
},
components: {
myCheckBox
},
})
</script>
</body>
</html>```