Static GitHub Issues

[2374] Wrong _uid for this in the transition hooks

prev: How fixed error "This dependency was not found: * plugin0 in ./.nuxt/index.js" in nuxt.config.js
next: Having a script tag inside page does not warn/error

I want to access this.$refs and methods for a page component in the transition object. But this referer to different component as they have different _uid? But by the look of it the components are the same, at least have the same this.$el.

I use 1.0.0-rc11 and though it was fixed in https://github.com/nuxt/nuxt.js/issues/566#issuecomment-307667535. But still have some issues.

created () {
   console.log(this._uid); // 57
},

beforeMount() {
   console.log(this._uid); // 57
},

mounted () {
   console.log(this._uid); // 57
},

transition: {
   mode: 'out-in',
   css: false,

   beforeEnter: function (el) {
      console.log(this._uid); // 15
   },

   enter: function (el, done) {
      console.log(this._uid); // 15
      done();
   },

   afterEnter: function (el) {
      console.log(this._uid); // 15
   },

   leave: function (el, done) {
      // I want to be able to do something like this
      // but this.fadeOutMethod is undefined
      // because this refer to a comp with _uid 15, not 57
      this.fadeOutMethod(() => {
         done();
      });
   }
}
<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c2066">#c2066</a>)</em></sub></div>