Vue 2.0 Hello World
by xu xiaofei
HTML
<script src="https://unpkg.com/vue"></script>
<div id="app">
<p>{{ message.a }}</p>
<p>{{ message.b }}</p>
<button @click="foo()">
click
</button>
</div>
JavaScript
new Vue({
el: '#app',
data: {
message: {}
},
computed:{
computed_message:function(){
return this.message + ' computed'
}
},
watch:{
message:function(){
}
},
methods:{
foo(){
this.message=Object.assign({a:'nmb',b:'hhh'})
setTimeout(()=> {
this.message.a='nms'
},1000)
}
}
})