Skip to content

yoxjs/yox-touch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

yox-touch

yox-touch 基于指令封装了 hammerjs,理论上拥有 hammerjs 所有的功能。

Install

NPM

npm install yox
npm install yox-touch
npm install hammerjs
import Yox from 'yox'
import * as YoxTouch from 'yox-touch'
Yox.use(YoxTouch)

CDN

<script src="https://unpkg.com/hammerjs@latest"></script>
<script src="https://unpkg.com/yox@latest"></script>
<script src="https://unpkg.com/yox-touch@latest"></script>
<script>
  // 必须手动注册
  YoxTouch.setHammer(window.Hammer)
  Yox.use(YoxTouch)
</script>

Usage

<div>
  <button on-tap="tap()">
    Tap
  </button>
  <button on-double-tap="doubleTap()">
    Double Tap
  </button>
  <button on-press="press()">
    Press
  </button>
  <button on-long-press="longPress()">
    Long Tap
  </button>
  <button on-swipe-left="swipeLeft()">
    swipeLeft
  </button>
  <button on-swipe-right="swipeRight()">
    swipeRight
  </button>
</div>
{
  methods: {
    tap: function () {

    },
    doubleTap: function () {

    }
  }
}

更多内容,请参考 hammerjs 文档

About

Hammer.js wrapper for Yox.js

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published