Coder Social home page Coder Social logo

Comments (8)

nicolasbeauvais avatar nicolasbeauvais commented on May 20, 2024 1

Nice catch 👍 it should be fixed in 2.2.10

from vue-social-sharing.

tmorehouse avatar tmorehouse commented on May 20, 2024 1

I noticed one other "caveat" when using inline-templates. The "scope" of anything in the inline-template is that of the parent (the component with the inline-template prop). If one needs to reference a computed property from their own component (in my case calculating a set of classes), one needs to reference $parent:

<template>
  <div>
    <social-sharing ... inline-template>
      <network network="facebook" :class="$parent.myClasses">Facebook</network>
      <network network="twitter" :class="$parent.myClasses">Twitter</network>
    </social-sharing>
  </div>
</template>

<script>
export default {
  computed: {
    myClasses() {
      return ['btn', 'btn-primary']
    }
  }
}
</script>

Might be worth noting in the documentation. (the Vue.js documentation is not overly clear on the scope of inline-template https://vuejs.org/v2/guide/components.html#Inline-Templates)

from vue-social-sharing.

tmorehouse avatar tmorehouse commented on May 20, 2024

You may want to consider using this library to handle merging of the context.data in functional components:

https://github.com/alexsasharegan/vue-functional-data-merge

We use this extensively in our functional components

from vue-social-sharing.

nicolasbeauvais avatar nicolasbeauvais commented on May 20, 2024

Thank you for the PR, the change has been tagged in https://github.com/nicolasbeauvais/vue-social-sharing/releases/tag/v2.2.9

The vue-functional-data-merge library could indeed be a nice addition to vue-social-sharing

from vue-social-sharing.

tmorehouse avatar tmorehouse commented on May 20, 2024

Yeah vue-functional-data-merge works quite well when merging context.data with additional attributes, etc.

We use it a lot in our functional components for Bootstrap-Vue (it was written by one of our members)

from vue-social-sharing.

tmorehouse avatar tmorehouse commented on May 20, 2024

Hmmm, I just upgraded to 2.2.9 and v-bound classes are still not working. only classes specified as a static string.

from vue-social-sharing.

tmorehouse avatar tmorehouse commented on May 20, 2024

These lines: https://github.com/nicolasbeauvais/vue-social-sharing/blob/master/src/social-sharing-network.js#L16-L18

Do not appear in the dist files:
https://github.com/nicolasbeauvais/vue-social-sharing/blob/master/dist/vue-social-sharing.js#L58-L61

It doesn't appear that the dist files were updated

from vue-social-sharing.

tmorehouse avatar tmorehouse commented on May 20, 2024

BTW... all is working great now... except one can't pass a title prop (or other arbitrary attributes).

Object.assign((), context.data.attrs, {.. custom data attrs here }) would work well for merging attributes, except for IE, which needs a polyfill for Object.assign :(

from vue-social-sharing.

Related Issues (20)

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.