09-组件通信-父传子(props的驼峰标识)
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>组件通信-父传子(props的驼峰标识)</title>
</head>
<body>
<div id="app">
<cpn :c-info="info"></cpn>
</div>
<template id="cpn">
<div>
<h2>{{cInfo}}</h2>
<h2>{{childMessageAge}}</h2>
</div>
</template>
<script src="../js/vue.js"></script>
<script>
const cpn = {
template: "#cpn",
props: {
cInfo: {
type: Object,
default() {
return {}
}
},
childMessageAge: {
type: String,
default: 'aaa'
}
}
}
const app = new Vue({
el: "#app",
data: {
info: {
name: "coderwhy",
age: 19,
height: 1.99
}
},
components: {
cpn
}
})
</script>
</body>
</html>