Coder Social home page Coder Social logo

nicolasbeauvais / vue-social-sharing Goto Github PK

View Code? Open in Web Editor NEW
1.4K 26.0 195.0 5.2 MB

A renderless Vue.js component for sharing links to social networks, compatible with SSR

Home Page: https://nicolasbeauvais.github.io/vue-social-sharing/

License: MIT License

JavaScript 94.69% HTML 0.78% CSS 3.69% Smarty 0.84%
vue vue-component social-shares vuejs vuejs2 vuejs-components vue-components social ssr nuxtjs

vue-social-sharing's Introduction

Hi there ๐Ÿ‘‹

vue-social-sharing's People

Contributors

2xaa avatar andrewvasilchuk avatar anteriovieira avatar awolf81 avatar b-ldx avatar carinachenot avatar ckgrafico avatar dependabot[bot] avatar dylankelly avatar edwinnnss avatar goodniceweb avatar hansfelix avatar husayt avatar ibrahimbeladi avatar jf-m avatar jhonata-menezes avatar khofaai avatar maxou44 avatar mtranggit avatar nicolasbeauvais avatar norbert-nagy-sg avatar pbun avatar plakhin avatar ram-you avatar rhyswfbowles avatar talkor avatar tmorehouse avatar vslio avatar wakecoder avatar yamaha252 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vue-social-sharing's Issues

Make it work without an root element?

Hi,

I have a structure like this and would like to remove the root in the component to not break the styling with my non-social settings. Is this possible somehow? When I try I can only see my first component and others are not there. Maybe we could make it possible to initiate my social-sharing elements in javascript instead or remove the requirement for a root element. Thanks for an awesome library.

<div class="settings">
    <div class="setting" @click="editProduct"> <!--v-if="isCuratorProduct(product)">-->
        <svg class="setting-icon edit" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
            <polygon points="16 3 21 8 8 21 3 21 3 16 16 3" fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/>
        </svg>
    </div>
    <div class="setting" @click="deleteProduct" v-if="isCuratorProduct(product)">
        <svg class="setting-icon trash" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
            <polyline points="3 6 5 6 21 6"/>
            <path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/>
        </svg>
    </div>
    <div class="setting" @click="editProductLinks" v-if="isCuratorProduct(product)">
        <svg class="setting-icon link" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
            <path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" fill="none" stroke="#000" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2"/>
            <path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" fill="none" stroke="#000" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2"/>
        </svg>
    </div>

    <social-sharing url="test.com"
        :title="this.shortTitle"
        :description="this.shortDescription"
        quote="Cool!"
        hashtags="quality, product, curated"
        twitter-user="test"
        v-cloak inline-template>
        <div> <!-- WANT TO REMOVE THIS ROOT -->
            <div class="setting facebook-share">
                <network network="facebook">
                    <i class="facebook f icon"></i>
                </network>
            </div>
            <div class="setting pinterest-share">
                <network network="pinterest">
                    <i class="pinterest icon"></i>
                </network>
            </div>
            <div class="setting twitter-share">
                <network network="twitter">
                    <i class="twitter icon"></i>
                </network>
            </div>
        </div>
    </social-sharing>
</div>

Can we get an interface to change the sharer url prefix for each social network?

For example, the prefix for pinterest is hardcoded as

https://pinterest.com/pin/create/button/?url=@url&media=@media&description=@title

However, this url will complain that there is no image for the pin if I don't pass a media value.

There is another URL which is https://www.pinterest.com/pin/find/?url=@url
It can load all the images in the page and let customer to choose one image and then create the pin.
This fits our use case and it exactly what we want.

But if I use this module, I find there is no way that I can change the hardcoded url to the "find" url above.

social_shares_click

Can you explain please what is this line for this.$emit('social_shares_click', network, this.url);
If I understood the purpose, it must be rather:
this.$root.$emit('social_shares_click', network, this.url);
to be able to use it as:
this.$root.$on('social_shares_click', callback)

Add Image to social sharing

hello i would like to know how to add an image in the social sharing since it's not described on the documentation

Unknown custom element: <network>

First of all this module looks promising to me! But when I try to use it I'm getting the following error in the Chrome developer console:

[Vue warn]: Unknown custom element: <network> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

I created a component named 'social-sharing' and included the vue social sharing in my app.js. In my component I used the syntax from the example that resulted in the error above. Any idea?

I'm on Vue 2 and I installed vue social sharing 1.1.2 via npm. Thanks!!

Error when network isn't in the list

Hello,

I encounter an error when the social network does't exist:
TypeError: Cannot read property 'type' of undefined
is it possible that it silently fail instead of trowing an error?

thanks in advance

Use component inside network comp.

Is it possible to use other components inside the network component?
e.g.

<network network="facebook">
    <my-custom-icon></my-custom-icon>
</network>

How to detect window popup are opened or closed?

Hi, sorry i'm newbie in vue.js and javascript, i need to add some stuff when the social sharing popup window are closed.
I need to detect the popup are closed, then i execute some function :)

How to update after data in component loads?

Hi love the plugin so far.

I want to update the twitter title, etc after the data from my vue-resource call loads.

In another plugin (vue-head) I can emit an .updateHead() method that will update the plugin to essentially resync the data.

Is there anything I can do here?

Thanks so much!

network component only allows static class list

the Network component only allows static class lists (i.e. a static string). If providing a class list via a computed property (v-bind:class=".."), no classes get applied:

Works:

<network class="foo bar" network="twitter">...</network>

Does not work:

<network :class="['foo', 'bar']" network="twitter">...</network>

This PR fixes the function <network> component by dealing with both staticClass and class properties

Dynamic props not working with webpack and single page components?

I have a SPA and in the socialshare component of my app I'm using vue-social-sharing plugin.
I have set inline-template and the props that I specify in the social-sharing tag are ok.
Inside the component I'm not able to reference any property of the vue component itself (for example my icons width and height that are stored as a data property and isMobileRequest that is a computed property).
Do you know if are there issues with this kind of setup or should it work as expected?

Socialize's counter

Nicolas, you did an amazing job. Thank you.
Of course, the beautiful example should be socialize.js. Can you add styles similar to them? Because for this moment people use more socialize.js only because of styles and counters.

Styling network span

I'm trying to style the network span here and it's not working. How can I style it?

Cannot read property 'extend' of undefined

I'm getting this error when clicking on the share button.

It works but it throws this error..

My dependencies:
"devDependencies": { "bootstrap-vue": "^0.16.1", "element-theme-default": "^1.3.4", "element-ui": "^1.2.8", "laravel-mix": "^0.8.3", "moment": "^2.18.1", "vue": "^2.1.10", "vue-blu": "^0.1.9", "vue-cookie-law": "^1.0.2", "vue-progressbar": "^0.7.1", "vue-resource": "^1.3.1", "vue-router": "^2.4.0", "vue-social-sharing": "^2.*", "vuex": "^2.2.1" }

image

As i said, it still works but it throws this strange error, i tryied to update my dependencies but im still having the same error...

Thanks for you help!

Using with nuxt.js - The client-side rendered virtual DOM tree is not matching server-rendered content.

Hi!

My configuration:
nuxt.config.js:

  plugins: [
    { src: '~plugins/social.js', ssr: false },
  ],

social.js:

import Vue from 'vue'
import SocialSharing from 'vue-social-sharing'

Vue.use(SocialSharing)

And then in a .vue file pasted <social-sharing url="https://vuejs.org/" inline-template>[...]

When entering the page I get on the console:

[Vue warn]: The client-side rendered virtual DOM tree is not matching server-rendered content. This is likely caused by incorrect HTML markup, for example nesting block-level elements inside <p>, or missing <tbody>. Bailing hydration and performing full client-side render. 

I understand the error but don't know how to fix it.

please add weibo support

just add below code in src/network.js

weibo: {
    sharer: 'http://service.weibo.com/share/share.php?url=@url&title=@title',
    type: 'popup'
  }

thanks.

๐Ÿ˜ƒ

Unknown custom element

Hi there,

I would like to add social network custom element icons in the Network tap i.e.

<network network="facebook">
  <facebook-icon size="30"></facebook-icon>
</network>

I import the cusotm element correctly. When i use it outside of network it works. Any help?

Support to pass custom data/methods

It would be nice to pass custom methods from my component to social sharing components. Let's say I have a custom click condition or something that needs to be trigged on the network tag.

I could do something like this:

<social-sharing url="example.com" :customMethods="myCustomMethods" inline-template>
   <network @click="customMethods.doSomethingCustom()">
   [....]

im a vue newbie so maybe that's not the best approach

Update SocialSharing when route changed

Hello,

I would like to use SocialSharing on different components, but the url used is the one of the first view rendered.

Example : If i land to the homepage, then i navigate to a single project, the share url will be the homepage one and not the single project one.

Is it a way to update/refresh/unmount-mount SocialSharing in this situation ?

Thanks a lot.

Email mailto: link

Any chance of also adding a regular old, but well formed email link?

Many thanks!

mailto option should include URL in message body

Sharing just the title and description is kind of useless. The URL needs to be in the email body, just before the description.

The URL would need to be percent encoded, followed by a percent encoded CRLF, then followed by the description

Cannot use special characters

When using <social-sharing :title="'C#'"> or :title="'C++'", the characters + or # are not there in the sharing windows for both twitter and facebook.

dynamic list of networks

Hello,

its not possible for me to loop the network list dynamically. how is it possible to read out the list of networks from p. e. vuex, and then render the list through v-for?

thanks for help

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.