npm.io
1.0.1 • Published 6 years ago

@vue-mixin/touch

Licence
MIT
Version
1.0.1
Deps
0
Size
8 kB
Vulns
0
Weekly
0
Stars
1

@vue-mixin/touch

Touch mixin for vue Demo


Install

npm install @vue-mixin/touch --save

Import

import touchMixin from "@vue-mixin/touch"

export default {
    mixins: [touchMixin],
}

Swipe
  • template
<div ref="touchSwipe"></div>
  • script
export default {
    methods: {
        /* ↑ */
        touchSwipeToUp() {
            console.log("Up")
        },

        /* ← */
        touchSwipeToLeft() {
            console.log("Left")
        },

        /* → */
        touchSwipeToRight() {
            console.log("Right")
        },

        /* ↓ */
        touchSwipeToDown() {
            console.log("Down")
        },
    },
}

Tap
  • template
<div ref="touchTap"></div>
  • script
export default {
    methods: {
        /* doesn't fire on click */
        touchTap() {
            console.log("Tap")
        },
    },
}

Keywords