Skip to content

10quality/vue-social-shares

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Social Shares Component (for Vue)

GitHub version Bower version

Social network sharing component for Vue Js.

Demo

Package index

Installation

Several installation options are available:

Usage

Add the following resources for the component to function correctly.

<!-- Required Javascript -->
<script src="vue.js"></script>
<script src="[component path]/dist/vue.social-shares.min.js"></script>

Add the component in your vue view.

<!-- Assuming your view app is APP. -->
<body id="app">

    <social-shares inline-template>
        <facebook>
            Share in facebook
        </facebook>
        <whatsapp>
            Share in whatsapp
        </whatsapp>
    </social-shares>

</body>

Props

List of available props to use in component:

Prop Data Type Default Description
url String current URL to share.
title String Sharing title (if available).
description String Sharing description (if available).
twitter-user String Twitter user (Only for twitter).

Usage example:

<body id="app">

    <social-shares inline-template
        :url.sync="url"
        twitter-user="10quality"
    >

        <facebook>
            <i class="fa fa-facebook"></i>
        </facebook>

        <twitter>
            <i class="fa fa-twitter"></i>
        </twitter>

    </social-shares>

</body>
new Vue({
    el: '#app',
    data: {url:undefined}, 
});

Custom binding

Instead of using child components to enable share functionality:

<body id="app">

    <social-shares inline-template>
        <facebook>
            Share in facebook
        </facebook>
    </social-shares>

</body>

Click event binding can be applied instead, using component method share:

<body id="app">

    <social-shares inline-template>
        <a title="Share in facebook"
            @click="share('facebook')"
        >
            Share in facebook
        </a>
    </social-shares>

</body>

Events

List of available events to use in component:

Event Passes Description
social_shares_click network: Selected network. url: shared url. Triggered when a share network is clicked.

Usage example:

new Vue({
    el: '#app',
    events: {
        'social_shares_click': function(network, url) {
            // TODO my code here
        }
    }, 
});

Networks supported

List of available networks to use in component:

Network Child component or key
Facebook facebook
Twitter twitter
Google + googleplus
Pinterest pinterest
Reddit reddit
LinkedIn linkedin
Whatsapp whatsapp (mobile only)

License

Copyright (c) 2016 10Quality. Under MIT License.