SOURCE

console 命令行工具 X clear

                    
>
console
Vue.component("comp",{
  props:["foo"],
  template:"<p v-on:click='change'>{{foo}}</p>",
  methods: {
    change: function () {
      this.$emit("update:foo",this.foo + " changed")
    }
  }
})

new Vue({
  el:"#app",
  data: {
    msg: "Hello Vue"
  }
})
<div id="app">
  <p>{{ msg }}</p>
  <!-- .sync在2.3.0重新引入 -->
  <comp :foo.sync="msg"></comp>
  <comp :foo="msg"  @update:foo="val => msg = val"></comp>
</div>
html,body{
  background-color:#333;
  color:#999;
}