<div id="app1">
<child msg="hello"></child>
<child nihao="hello1!"></child>
<child nisha="hello2!"></child>
<p v-if="male">male</p>
<p v-if="female">female</p>
<p v-if="age>25">Age:{{age}}</p>
<p v-if="name.indexOf('lin')>0">Name:{{name}}</p>
</div>
<script>
Vue.component('child',{
props:['msg','nihao','nisha'],
template: '<span>{{msg}}123{{nihao}}{{nisha}}</span>',
})
const vue = new Vue({
el: '#app1',
data:{
male: true,
female: false,
age: 29,
name: 'colin'
}
})
</script>
參考文章
http://www.jb51.net/article/95802.htm