yox-touch

0.11.4 • Public • Published

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 文档

Package Sidebar

Install

npm i yox-touch

Weekly Downloads

3

Version

0.11.4

License

MIT

Unpacked Size

366 kB

Total Files

10

Last publish

Collaborators

  • musicode