<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Component 组件props 属性设置</title>
<meta name="flexible" content="initial-dpr=2,maximum-dpr=3" />
<meta name="apple-mobile-web-app-capable" content="yes">
<meta content="yes" name="apple-touch-fullscreen">
<meta content="telephone=no,email=no" name="format-detection">
<meta content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport">
<script src="../assets/js/flexible_css.js"></script>
<script src="../assets/js/flexible.js"></script>
<script src="../assets/js/vue.js"></script>
</head>
<body>
<div id="app">
<caicai here="China"></caicai>
<caicai :here="message"></caicai> <!--第二种方式:通过 v-bind方法 :here 是简写 把构造器中data的值传递给组件-->
</div>
</body>
<script type="text/javascript">
var app=new Vue({
el:"#app",
data:{
message:"liao ning",
},
components:{
"caicai":{
template:`<div style="color:green">I'm from {{here}}</div>`, //{{here}}组件的模板里读出属性值
props:['here'] //props 支撑 支持 使倚靠在某物上;//here 属性 传递china 值给组件
}
}
})
//// vue不支持 带 - 命名方式 可以小城驼峰形式(第二个单词首字母大写) 大驼峰 (从第一个单词开始,每个单词首字母都大写)
</script>
</html>