Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/knowscount/vue-selection-share

📄 a medium-like text highlight sharing component
https://github.com/knowscount/vue-selection-share

component medium share text-highlight vue vue2

Last synced: 2 days ago
JSON representation

📄 a medium-like text highlight sharing component

Awesome Lists containing this project

README

        

# vue-selection-share

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

to learn how I created this, click [this](https://juejin.cn/post/6970687166145904654) to read a chinese tutorial.

![](https://knowscount-1304485449.cos.ap-shanghai.myqcloud.com/img/Screenshot%202021-06-01%20at%2021.21.11.png)

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:

```vue.js
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:

```vue.js

mother of god

```

lastly add the `methods`, to `onShare` and `onHighlight`:

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

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