vue-youtube-widget
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
Installation
npm
npm i vue-youtube-widget
Github
- Clone repository
https://github.com/dmitriyakkerman/vue-youtube-widget.git
- Install dependencies
npm install
Usage
- 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! 🎉
Props
apiKey
API key from Google API Console
Type: String
Required: true
channelId
ID of Youtube channel
Type: String
Required: true
resultsPerRequest
Number of requested videos per request
Type: Number
Required: false
Default: 1
subscribersCountText
"subscribers" word replacement for localized text using vue-i18n
Type: String
Required: false
Default: "subscribers"
subscribeBtnText
"Subscribe" word replacement in "Subscribe" button for localized text using vue-i18n
Type: String
Required: false
Default: "Subscribe"
loadMoreBtnText
"Load more" word replacement in "Load more" button for localized text using vue-i18n
Type: String
Required: false
Default: "Load more"