Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to support Vue3 #82

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

ainarend
Copy link

@ainarend ainarend commented Jul 19, 2021

Here are the necessary changes to the vue-youtube for it to work with Vue3.

Ignore the changes to the ./dist folder, I made those for my own project so I could continue using the component while the package gets updated, as I was unable to quickly get the rollup build to work with vue#. But Vue3 drops the support for older browsers anyway, so worth thinking about which bundles are needed.

Important changes are these:

  • beforeDestroy -> beforeUnmount
  • instead of render(h) { return h('div'); } using render () { return h('div') } and import { h } from 'vue'
  • Use @vue/compiler-sfc instead of vue-template-compiler
  • src/index.js changes for the plugin() method to install the plugin globally (not tested, as I am not using the plugin globally)

I guess this should be a tagged release in a new major version to keep the vue2 release as well.

Oh, and a side note on using the fork/PR version already. When using the plugin locally in components, i was using it in vue2 like this:
import { Youtube } from 'vue-youtube';
but since i did not use the rollup to do the release, rather just copied the component to dist as modern browsers can handle it, then you can use the component locally like this:
import Youtube from 'vue-youtube';

@komali2
Copy link

komali2 commented Oct 21, 2021

@anteriovieira sup

@MaxKorlaar
Copy link

I'd love to see this PR get merged, even in 2023 :)!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants