vue-youtube icon indicating copy to clipboard operation
vue-youtube copied to clipboard

Cannot read property 'getIdFromUrl' of undefined

Open papakay opened this issue 5 years ago • 4 comments

I really commend the great effort put into this package.

I'm currently using version 1.3.4

I have a method as below

getId() { return this.$youtube.getIdFromUrl(this.videoUrl); }

The out output of console.log(this.$youtube); is shown in the attached screenshot

Screenshot 2019-05-19 at 5 22 48 AM

Please how can i resolve this?

papakay avatar May 19 '19 04:05 papakay

There are no any problems - https://codesandbox.io/s/vue-template-474dz Show your code, for example using codesandbox.

TitanFighter avatar May 19 '19 07:05 TitanFighter

Thank you so much @TitanFighter .

I'm using this inside a nuxt app.

I created a plugin with the following code.

import Vue from 'vue'
import VueYoutube from 'vue-youtube'
 
Vue.use(VueYoutube)

Then i have a method inside my page that looks like below

 getId() {
      return this.$youtube.getIdFromUrl(this.videoUrl);
    }

papakay avatar May 19 '19 17:05 papakay

I do not use nuxt :(

TitanFighter avatar May 19 '19 22:05 TitanFighter

Here is shown how to use vue-youtube with nuxt.

TitanFighter avatar Jul 07 '21 12:07 TitanFighter