Code Monkey home page Code Monkey logo

vue-tap-mixin's Introduction

vue-tap-mixin

npm version Gzip Size Monthly Downloads License: MIT

Automatically convert click event to tap event without delay on the mobile side. Suported all Vue click event modifiers.

  • .stop
  • .prevent
  • .capture
  • .self
  • .once
  • .passive

Installation

Install

$ npm install vue-tap-mixin --save
# or
$ yarn add vue-tap-mixin

ES6

import VueTapMixin from 'vue-tap-mixin'

Vue.use(VueTapMixin)

CommonJS

var Vue = require('vue');
var VueTapMixin = require('vue-tap-mixin');

Vue.use(VueTapMixin);

Browser

<script src="https://unpkg.com/vue@latest"></script>
<script src="https://unpkg.com/vue-tap-mixin@latest/dist/vue-tap-mixin.umd.js"></script>
<!-- OR -->
<script src="path/to/vue/vue.min.js"></script>
<script src="path/to/vue-tap-mixin/dist/vue-tap-mixin.umd.js"></script>

Useage

<template>
  <div id="app">
    <div @click="goTap($event, 'Tap 2')">Tap 1</div>
    <div @tap.stop="goTap($event, 'Tap 2')">Tap 1</div>
    <div @tap.prevent="goTap($event, 'Tap 2')">Tap 1</div>
    <div @tap="goTap($event, 'Tap 2')">Tap 1</div>
    <div @tap="(e) => { goTap(e, 'Tap 2') }">Tap 2</div>
    <div @tap="goTap2('Tap 3')">Tap 3</div>
    <button type="button" disabled="disabled" @tap="notWorks">Not trigger tap event</button>
    {{ aaa }}
  </div>
</template>

<script>
export default {
  name: 'app',
  data() {
    return {
      aaa: ''
    }
  },
  methods: {
    goTap(e, txt) {
      console.log(e)
      this.txt = txt
    },
    goTap2(txt) {
      this.txt = txt
    }
  }
}
</script>

MIT License

Copyright © 2019 LinQuan.

vue-tap-mixin's People

Contributors

mlinquan avatar erjanmx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar xml avatar stephen avatar DUDU avatar  avatar  avatar 池小洋丶 avatar 子青Li avatar impguier avatar  avatar examination avatar  avatar gaohongjun avatar 杜远 avatar away avatar  avatar  avatar

Watchers

James Cloos 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.