Git Product home page Git Product logo

vue-github-buttons's Introduction

Vue GitHub Buttons

license vue 2 npm npm Travis Codacy grade ESLint Gluons

:octocat: GitHub buttons component for Vue.

Installation

Via NPM:

NPM

npm install vue-github-buttons

Via Yarn:

yarn add vue-github-buttons

Demo

Go to https://gluons.github.io/vue-github-buttons

Usage

import Vue from 'vue';
import VueGitHubButtons from 'vue-github-buttons';
import App from './App.vue';

// Stylesheet
import 'vue-github-buttons/dist/vue-github-buttons.css';

Vue.use(VueGitHubButtons);
// Or if your don't want to use cache
Vue.use(VueGitHubButtons, { useCache: false });

new Vue({
	el: '#app',
	render: h => h(App)
});
<template>
	<div id="app">
		<gh-btns-watch slug="vuejs/vue" show-count></gh-btns-watch>
		<gh-btns-star slug="vuejs/vue" show-count></gh-btns-star>
		<gh-btns-fork slug="vuejs/vue" show-count></gh-btns-fork>
		<gh-btns-follow user="yyx990803" show-count></gh-btns-follow>
	</div>
</template>

<script>
// JavaScript ...
</script>

<style>
/* Style ... */
</style>

Using with Nuxt

Add vue-github-buttons/nuxt to modules in nuxt.config.js.

module.exports = {
	modules: [
		'vue-github-buttons/nuxt',
		// Or with options
		['vue-github-buttons/nuxt', {
			css: false, // Don't include CSS
			useCache: false // Don't use cache
		}]
	]
};

Module options

css

Type: Boolean
Default: true

Include Vue GitHub Buttons's CSS.

useCache

Type: Boolean
Default: true

Enable caching. (See below)

Using with VuePress

Require VuePress v1.x

Add Vue GitHub Buttons to your plugins in .vuepress/config.js.

module.exports = {
	plugins: [
		require('vue-github-buttons/plugins/vuepress'),

		/* Or using plugin with options */

		[
			require('vue-github-buttons/plugins/vuepress'),
			{
				useCache: false
			}
		]
	]
}

Plugin options are the same as Vue plugin options.

API

Plugin Options

useCache

Type: Boolean
Default: true

Enable count number caching. (Use session storage)

GitHub API has limited requests. So, caching may be useful when user refresh the webpage.

Vue.use(VueGitHubButtons, { useCache: false }); // Disable cache

Components

gh-btns-watch

๐Ÿ‘๏ธ A watch button.

  • slug - GitHub slug (username/repo).
  • show-count - Enable displaying the count number.

gh-btns-star

โญ A star button.

  • slug - GitHub slug (username/repo).
  • show-count - Enable displaying the count number.

gh-btns-fork

๐Ÿด A fork button.

  • slug - GitHub slug (username/repo).
  • show-count - Enable displaying the count number.

gh-btns-follow

๐Ÿ‘ค A follow button.

  • user - GitHub username.
  • show-count - Enable displaying the count number.

vue-github-buttons's People

Contributors

dependabot[bot] avatar github-actions[bot] avatar gluons avatar idelsink avatar ramsesgarate avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.