Vue.js YouTube widget for your website using YouTube API 3.
- Fetches channel's logo, name and subscribers count
- Fetches initial count of videos
- Loads additional videos
npm i vue-youtube-widget
- Clone repository
https://github.com/dmitriyakkerman/vue-youtube-widget.git
- Install dependencies
npm install
- Import "YouTubeWidget" component in you app
<template>
<div>
<YouTubeWidget apiKey="YOUR_API_KEY" channelId="YOUR_CHANNEL_ID"></YouTubeWidget>
</div>
</template>
<script>
import YouTubeWidget from "./components/YouTubeWidget";
export default {
components: {
YouTubeWidget
}
}
</script>
- Configure component additional props if needed:
<template>
<div>
<YouTubeWidget
apiKey="YOUR_API_KEY"
channelId="YOUR_CHANNEL_ID"
:resultsPerRequest="4"
subscribersCountText="подписчиков"
subscribeBtnText="Подписаться"
loadMoreBtnText="Загрузить еще"
></YouTubeWidget>
</div>
</template>
...
- Import "YouTubeWidget" basic styles from "main.scss"
...
<style>
@import "~vue-youtube-widget/dist/YouTubeWidget.min.css";
</style>
- Write your additional custom styles for widget.
- Enjoy! 🎉
API key from Google API Console
Type: String
Required: true
ID of Youtube channel
Type: String
Required: true
Number of requested videos per request
Type: Number
Required: false
Default: 1
"subscribers" word replacement for localized text using vue-i18n
Type: String
Required: false
Default: "subscribers"
"Subscribe" word replacement in "Subscribe" button for localized text using vue-i18n
Type: String
Required: false
Default: "Subscribe"
"Load more" word replacement in "Load more" button for localized text using vue-i18n
Type: String
Required: false
Default: "Load more"