title: Vue.js event bus
body: <p>I'm working on a vue single page project,and I use an empty Vue instance as a central event bus.But there is some problem when firing a event.</p>
  
  <p>eventbus.js</p>
  
  <pre><code>import vue from 'Vue'
  export default new vue({})
  </code></pre>
  
  <p>a.vue</p>
  
  <pre><code>import bus from '~js/eventBus'
  methods: {
      go(name) {
          bus.$emit('setPartner', name);
              this.$router.go(-1);
      }
  }
  </code></pre>
  
  <p>b.vue</p>
  
  <pre><code>import bus from '~js/eventBus'
  data() {
           return {
             contract: {
                 contractSubject: ''
             }
           }
       },
  mounted(){
  
       bus.$once('setPartner', data =&gt; {
            this.contract.contractSubject = data;
       });
  }
  </code></pre>
  
  <p>in b.vue file,I can recieve data,but I can't assign the value of data to 'this.contract.contractSubject'</p>