Vue
by Alex Liu
HTML
<div id="app">
</div>
CSS
body {
padding: 20px;
font-family: Helvetica;
}
#app {
background: #fff;
border-radius: 4px;
padding: 20px;
transition: all 0.2s;
}
li {
margin: 8px 0;
}
h2 {
font-weight: bold;
margin-bottom: 15px;
}
del {
color: rgba(0, 0, 0, 0.3);
}
Vue
Vue.component('child-inner', {
props: {
name: String,
age: Number
},
template: "<div class='child-inner'> {{name}}, age: {{age}}</div>"
})
Vue.component('child', {
props: {
name: String,
age: Number
},
template: '<div class="child"> <child-inner :name="name" :age="age"></child-inner></div>'
})
new Vue({
el: "#app",
template: ' <child notProps="hello" :name="name" :age="age"></child>',
data: {
name: '小明',
age: 3
}
})