vue-flex-touch

1.0.0 • Public • Published

vue-flex-touch

A for Vue.js directive both for long press touch on mobile and right click on pc

demo

https://n0v3orw484.codesandbox.io/

Install

npm install vue-flex-touch

Usage

 
// main
import flexTouch from 'vue-flex-touch'
 
Vue.use(flexTouch, { timeout: 900 });
 
// component
<div id="app" v-flex-touch="handleTouch">
  <h1>I'm flex touch demo</h1>
  {{flex}}
</div>
 
 
data() {
  return {
    flex: false
  };
},
methods: {
  handleTouch() {
    this.flex = !this.flex;
  }
}

examle

base use

Edit Vue Template

used in chat '@'

Edit Vue Template

config

Prop Type default description
timeout number 500 time for long touch. (only mobile)
needSelect boolean false If it is true, it will select text)
preventDefault boolean true If it is true, it will stop default event)

reference

License

MIT

Copyright (c) 2019 蓝色的秋风

Package Sidebar

Install

npm i vue-flex-touch

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

324 kB

Total Files

18

Last publish

Collaborators

  • hua1995116