|
1 | 1 | [](https://github.com/dmitriyakkerman/vue-youtube-widget/actions/workflows/test.yml) |
2 | 2 | # vue-youtube-widget |
3 | 3 |
|
4 | | -Simple Vue.js youtube widget for your website using YouTube Api 3. |
| 4 | +> Simple Vue.js youtube widget for your website using YouTube Api 3. |
5 | 5 |
|
6 | | - |
| 6 | + |
7 | 7 |
|
| 8 | +* Fetches channel's logo, name and subscribers count |
| 9 | +* Fetches initial count of videos |
| 10 | +* Loads additional videos |
| 11 | + |
| 12 | +## Usage |
| 13 | + |
| 14 | +1. Clone repository |
| 15 | +```js |
| 16 | +https://github.com/dmitriyakkerman/vue-vuex-i18n-browser-sfc-starter.git |
| 17 | +``` |
| 18 | +2. Install dependencies |
| 19 | +```js |
| 20 | +npm install |
| 21 | +``` |
| 22 | +3. Import "YouTubeWidget" component in you app |
| 23 | + |
| 24 | +```js |
| 25 | +<template> |
| 26 | + <div id="app"> |
| 27 | + <YouTubeWidget apiKey="YOUR_API_KEY" channelId="YOUR_CHANNEL_ID"></YouTubeWidget> |
| 28 | + </div> |
| 29 | +</template> |
| 30 | + |
| 31 | +<script> |
| 32 | +import YouTubeWidget from "./components/YouTubeWidget"; |
| 33 | + |
| 34 | +export default { |
| 35 | + name: 'App', |
| 36 | + components: { |
| 37 | + YouTubeWidget |
| 38 | + } |
| 39 | +} |
| 40 | +</script> |
| 41 | + |
| 42 | +``` |
| 43 | + |
| 44 | +4. Configure component additional props if needed: |
| 45 | + |
| 46 | +```js |
| 47 | +<template> |
| 48 | + <div id="app"> |
| 49 | + <YouTubeWidget |
| 50 | + apiKey="YOUR_API_KEY" |
| 51 | + channelId="YOUR_CHANNEL_ID" |
| 52 | + :resultsPerRequest="4" |
| 53 | + :subscribersCountToFixed="1" |
| 54 | + subscribersCountText="подписчиков" |
| 55 | + subscribeBtnText="Подписаться" |
| 56 | + loadMoreBtnText="Загрузить еще" |
| 57 | + ></YouTubeWidget> |
| 58 | + </div> |
| 59 | +</template> |
| 60 | + |
| 61 | +... |
| 62 | +``` |
| 63 | + |
| 64 | +5. Import "YouTubeWidget" base styles from "main.scss" |
| 65 | + |
| 66 | +```css |
| 67 | +... |
| 68 | + |
| 69 | +<style lang="scss"> |
| 70 | + @import "main.scss"; |
| 71 | +</style> |
| 72 | + |
| 73 | +``` |
| 74 | + |
| 75 | +6. Write your additional custom styles for widget. |
| 76 | +7. Run dev server: |
| 77 | + |
| 78 | +```js |
| 79 | +npm run serve |
| 80 | +``` |
| 81 | +8. Enjoy! 🎉 |
| 82 | + |
| 83 | +------------- |
| 84 | + |
| 85 | +### Props |
| 86 | + |
| 87 | +##### `apiKey` |
| 88 | +API key from Google API Console |
| 89 | + |
| 90 | +*Type:* String |
| 91 | + |
| 92 | +*Required:* true |
| 93 | + |
| 94 | +##### `channelId` |
| 95 | +ID of Youtube channel |
| 96 | + |
| 97 | +*Type:* String |
| 98 | + |
| 99 | +*Required:* true |
| 100 | + |
| 101 | +##### `resultsPerRequest` |
| 102 | +Number of requested videos per request |
| 103 | + |
| 104 | +*Type:* Number |
| 105 | + |
| 106 | +*Required:* false |
| 107 | + |
| 108 | +*Default:* 1 |
| 109 | + |
| 110 | +##### `subscribersCountToFixed` |
| 111 | +The number of digits to appear after the decimal point in subscribers count |
| 112 | + |
| 113 | +*Type:* Number |
| 114 | + |
| 115 | +*Required:* false |
| 116 | + |
| 117 | +*Default:* 1 |
| 118 | + |
| 119 | +##### `subscribersCountToFixed` |
| 120 | +The number of digits to appear after the decimal point in subscribers count |
| 121 | + |
| 122 | +*Type:* Number |
| 123 | + |
| 124 | +*Required:* false |
| 125 | + |
| 126 | +*Default:* 1 |
| 127 | + |
| 128 | +##### `subscribersCountText` |
| 129 | +"subscribers" word replacement for localized text using vue-i18n |
| 130 | + |
| 131 | +*Type:* String |
| 132 | + |
| 133 | +*Required:* false |
| 134 | + |
| 135 | +*Default:* "subscribers" |
| 136 | + |
| 137 | +##### `subscribeBtnText` |
| 138 | +"Subscribe" word replacement in "Subscribe" button for localized text using vue-i18n |
| 139 | + |
| 140 | +*Type:* String |
| 141 | + |
| 142 | +*Required:* false |
| 143 | + |
| 144 | +*Default:* "Subscribe" |
| 145 | + |
| 146 | +##### `loadMoreBtnText` |
| 147 | +"Load more" word replacement in "Load more" button for localized text using vue-i18n |
| 148 | + |
| 149 | +*Type:* String |
| 150 | + |
| 151 | +*Required:* false |
| 152 | + |
| 153 | +*Default:* "Load more" |
0 commit comments