Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hua1995116/vue-flex-touch
A Vue.js directive both for long press touch on mobile and right click on pc.
https://github.com/hua1995116/vue-flex-touch
directive mobile pc rightclick touch vue
Last synced: about 23 hours ago
JSON representation
A Vue.js directive both for long press touch on mobile and right click on pc.
- Host: GitHub
- URL: https://github.com/hua1995116/vue-flex-touch
- Owner: hua1995116
- License: mit
- Created: 2019-05-14T12:47:50.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-03T21:54:37.000Z (about 2 years ago)
- Last Synced: 2024-12-21T13:25:55.561Z (about 2 months ago)
- Topics: directive, mobile, pc, rightclick, touch, vue
- Language: Vue
- Homepage:
- Size: 638 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 31
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vue-flex-touch
> A Vue.js directive both for long press touch on mobile and right click on pc
# Demo
https://n0v3orw484.codesandbox.io/
# Install
```shell
npm install vue-flex-touch
```# Usage
```javascript// main
import flexTouch from 'vue-flex-touch'Vue.use(flexTouch, { timeout: 900 });
// component
I'm flex touch demo
{{flex}}data() {
return {
flex: false
};
},
methods: {
handleTouch() {
this.flex = !this.flex;
}
}
```# Examle
## base use
[![Edit Vue Template](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/n0v3orw484?fontsize=14)
## used in chat '@'
[![Edit Vue Template](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/oovv1q83zz?fontsize=14)
# Options
| Prop | Type | default | description |
| --- | --- | --- | --- |
| timeout | number | 500(ms) | time for long touch. (only mobile) |
| needSelect | boolean | false | If true, select text |
| preventDefault | boolean | true | If true, stop default event) |# API
```
vue-flex-touch="handleTouch"handleTouch(e, type) => void
```Arguements:
- **e** `{Object}` event callback
- **type** `'touch'|'rightClick'` enum type# License
MIT
Copyright (c) 2019 蓝色的秋风