vue-selection-share

a medium-like text highlight sharing component with zero dependencies.

Usage no npm install needed!

<script type="module">
  import vueSelectionShare from 'https://cdn.skypack.dev/vue-selection-share';
</script>

README

vue-selection-share

a medium-like text highlight sharing component with zero dependencies.

to learn how I created this, click this to read a chinese tutorial.

well, it's all about reinventing the wheel.


🤤 usage

to install the single file component, run:

npm install --save vue-selection-share

to use the component:

import VueSelectionShare from 'vue-selection-share';
Vue.use(VueSelectionShare)

then add the component outside of the elements that needs the popover, and the clicking behaviours:

<VueSelectionShare @share="onShare" @highlight="onHighlight">
    <p>mother of god</p>
</VueSelectionShare>

lastly add the methods, to onShare and onHighlight:

methods: {
    onShare (text) {
        console.log('share:', text)
    },

    onHighlight (text) {
        console.log('highlight:', text)
    }
}