vue-social-sharing2
Vue Social Share2
Based on Web Share API https://www.w3.org/TR/web-share/
Installation
npm install vue-social-sharing2
Loading the library in components/pages
Browserify / Webpack / Nuxt.js
import VueSocialShare2 from "vue-social-sharing2"
Using the sharer component
<VueSocialShare2
:styleConfig="{
backgroundColor: 'none',
color: '#fff',
top: '50%',
right: '-10px',
transform: 'translateY(-50%)',
backgroundImage: 'BUTTON BACKGROUND IMAGE URL OR MENTION THE BUTTON TEXT BELOW',
backgroundRepeat: none,
height: '100px',
}"
:networks="networks"
buttonText=""
:webShareData="{
title: 'Arju S Moon',
text: 'Demo Text',
url: 'https://schbang.com',
image: 'https://images.unsplash.com/photo-1552519507-da3b142c6e3d?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1500&q=80',
}"
/>
-
styleConfig prop overrides all the default styles of the sharer button.
-
webShareData prop is specifically to use with the Web Share API on mobile devices
Available Networks
Network | Properties |
---|---|
title, description, url, hashtag | |
text, url, hashtags(Array) | |
text |
Defining Network Array
networks: [
{
network: "facebook",
title: "Arju S Moon",
description: "Arju Desc",
url: "https://saffola.in/oodles",
hashtag: "#arjusmoon",
},
{
network: "twitter",
text: "Saffola Oodles",
url: "https://saffola.in/oodles",
hashtags: ["hashtag", "test", "saffola"],
},
{
network: "whatsapp",
text: "Test Post https://schbang.com",
},
],
Dependencies
@babel/core: ^7.12.10@babel/preset-env: ^7.12.11@rollup/plugin-alias: ^3.1.1@rollup/plugin-babel: ^5.2.2@rollup/plugin-commonjs: ^17.0.0@rollup/plugin-node-resolve: ^11.0.1@rollup/plugin-replace: ^2.3.4@vue/cli-plugin-babel: ^4.5.10@vue/cli-service: ^4.5.10cross-env: ^7.0.3minimist: ^1.2.5rollup: ^2.36.1rollup-plugin-terser: ^7.0.2rollup-plugin-vue: ^5.1.9vue: ^2.6.12vue-template-compiler: ^2.6.12