title: beforeRouteEnter doesn't work in vue child component
body: <p>I try to detect what is the previous route in my component. I use <code>beforeRouteEnter</code> to find it. it works in <strong>CreditAdd.vue</strong> but when I use <code>beforeRouteEnter</code> in <strong>Back.vue</strong> it doesn't work!</p>
  
  <p>I think it because the Back component is a child. but I can't solve the problem</p>
  
  <p>Back.vue:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>&lt;template&gt;
    &lt;i class="bi ba-arrow-right align-middle ml-3" style="cursor: pointer" @click="handleBack"&gt;&lt;/i&gt;
  &lt;/template&gt;
  
  &lt;script&gt;
  export default {
    name: 'Back',
    data() {
      return {
        id: null
      };
    },
    beforeRouteEnter(to, from, next) {
      console.log('please log');
      next(vm =&gt; {
        vm.fromRoute = from;
      });
    },
    mounted() {},
    methods: {
      handleBack() {
        if (!this.fromRoute.name) {
          this.$router.push({ name: 'dashboard' });
        } else {
          this.$router.back();
        }
      }
    }
  };
  &lt;/script&gt;</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"&gt;&lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>CreditAdd.vue:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;template&gt;
    &lt;Layout&gt;
      &lt;template slot="header"&gt;
        &lt;Back /&gt;
        &lt;span&gt;افزایش اعتبار&lt;/span&gt;
      &lt;/template&gt;
  
      &lt;div class="col-lg-10 px-0"&gt;
        &lt;Card&gt;
          &lt;template v-if="type == 'select'"&gt;
            &lt;credit-add-way @select="changeType"&gt;&lt;/credit-add-way&gt;
          &lt;/template&gt;
  
          &lt;template v-if="type == 'bank'"&gt;
            &lt;credit-add-bank-way @back="changeType('select')"&gt;&lt;/credit-add-bank-way&gt;
          &lt;/template&gt;
  
          &lt;template v-if="type == 'code'"&gt;
            &lt;credit-add-code-way @back="changeType('select')"&gt;&lt;/credit-add-code-way&gt;
          &lt;/template&gt;
        &lt;/Card&gt;
      &lt;/div&gt;
    &lt;/Layout&gt;
  &lt;/template&gt;</code></pre>
  </div>
  </div>
  </p>