SOURCE

console 命令行工具 X clear

                    
>
console
Vue.component('base-input', {
  inheritAttrs: false,
  computed: {
    inputListeners: function () {
      var vm = this
      // `Object.assign` 将所有的对象合并为一个新对象
      return Object.assign({},
        // 我们从父级添加所有的监听器
       this.$listeners,
        // 然后我们添加自定义监听器,
        // 或覆写一些监听器的行为
    {
    //这里确保组件配合 `v-model` 的工作
    input: function (event) {
    console.log(this)
    vm.$emit('input', event.target.value)
    }
    }
      )
    }
  },
  template: `<label> {{ label }} <input v-bind:value="value" v-on="inputListeners">
	 <input >
    </label>`
})
new Vue({
  el:'#app',
  data:{
    message:'hello',
    x:'',
    value:'ds'
  },
  methods:{
    write:function(x){
      console.log(1,this.$listeners)
    }
  }
})
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
  <div id="app">
    <base-input v-on:input.native="write" v-model="x" value="" label="dddd"></base-input>
    <p>{{ message }}</p>
  </div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.0.3/vue.js"></script>

</body>
</html>