Skip to content

Vue.js YouTube widget for your website using YouTube API 3

Notifications You must be signed in to change notification settings

dmitriyakkerman/vue-youtube-widget

Repository files navigation

test

vue-youtube-widget

Vue.js YouTube widget for your website using YouTube API 3.

vue-youtube-widget

  • Fetches channel's logo, name and subscribers count
  • Fetches initial count of videos
  • Loads additional videos

Installation

npm

npm i vue-youtube-widget

Github

  1. Clone repository
https://github.com/dmitriyakkerman/vue-youtube-widget.git
  1. Install dependencies
npm install

Usage

  1. 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>
  1. 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>

...
  1. Import "YouTubeWidget" basic styles from "main.scss"
...

<style>
  @import "~vue-youtube-widget/dist/YouTubeWidget.min.css";
</style>
  1. Write your additional custom styles for widget.
  2. 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"