Giter Site home page Giter Site logo

vue-finger's Introduction

vue-finger

Vuejs 手势库,基于 AlloyFinger 开发

预览

Live Demo

移动端体验更佳
PC 端记得打开手机模拟器

安装

npm i -S @gauseen/vue-finger
# OR
yarn add @gauseen/vue-finger

使用

// main.js

import Vue from 'vue'
import VueFinger from '../src/directives'

Vue.use(VueFinger)
<template>
  <button v-fg:tap="tap" :style="styleTapBgColor">tap</button>
</template>

<script>
export default {
  name: 'demo',
  methods: {
    tap (evt) {
      console.log('tap: ', evt)
    },
  },
}
</script>

浏览器导入

<script type="text/javascript" src="https://unpkg.com/@gauseen/vue-finger"></script>

Api

监听手势事件

可以用 v-fg 指令监听 DOM 手势事件,并在触发时运行 JavaScript 函数

v-fg

  • 值: Function
  • 参数手势: touchStart | touchMove | touchEnd | touchCancel | tap | doubleTap | singleTap | longTap | rotate | pinch | pressMove | swipe | multipointStart | multipointEnd

示例:

<template>
  <!-- 双击 -->
  <button v-fg:doubleTap="someHandle">doubleTap</button>
  <!-- 上、右、下、左滑动 -->
  <button v-fg:swipe="someHandle">swipe</button>
  <!-- 双指旋转-->
  <button v-fg:rotate="someHandle">rotate</button>
  <!-- 双指缩放-->
  <button v-fg:pinch="someHandle">rotate</button>
</template>

<script>
export default {
  name: 'demo',
  methods: {
    someHandle (evt) {
      console.log('someHandle: ', evt)
    },
  },
}
</script>

vue-finger's People

Contributors

gauseen avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

lp150612

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.