GithubHelp home page GithubHelp logo

vue-touch-1's Introduction

kim-vue-touch

Installation

npm install kim-vue-touch

Usage

import vueTouch from 'kim-vue-touch'

Vue.use(vueTouch)

  • kim-vue-touch提供了点击、长按、左滑、右滑、上滑、下滑等事件,
  • 当你不需要传参时可以通过v-tap="vueTouch"的形式调用方法,
  • 当你需要传参时v-tap="(e)=>vueTouch('点击',e)"的方式调用,e是event对象
  • 当指令搭配v-for使用时,一定要确保key值的唯一性,否则不能保证数据刷新之后事件被重新绑定(参考vue就地复用机制)
<template>
    <div class="box" 
        v-tap="(e)=>vueTouch('点击',e)" 
        v-longtap="(e)=>vueTouch('长按',e)" 
        v-swipeleft="(e)=>vueTouch('左滑',e)"
        v-swiperight="(e)=>vueTouch('右滑',e)"
        v-swipeup="(e)=>vueTouch('上滑',e)"
        v-swipedown="(e)=>vueTouch('下滑',e)"
    ></div>
</template>
<script>
    export default {
        name: 'App',
        data () {
            return {
                name:'touch',
            }
        },
        methods:{
            vueTouch:function(txt,e){
                this.name = txt;
            }
        }
    }
</script>

vue-touch-1's People

Contributors

904790204 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.