omi-finger

针对移动端,负责的手势交互,我们也提供了 omi-finger 手势交互库。你可以移动端打开这个页面看看 omi-finger 的能力:

→ omi-finger demo

使用:

  1. import { render, tag, WeElement, observe } from 'omi'
  2. import 'omi-finger'
  3. @observe
  4. @tag('my-app')
  5. class MyApp extends WeElement {
  6. install() {
  7. this.data.wording = 'Tap or Swipe Me!'
  8. }
  9. handleTap = (evt) => {
  10. this.data.wording += '\r\nTap'
  11. }
  12. handleSwipe = (evt) => {
  13. this.data.wording += '\r\nSwipe-' + evt.direction
  14. }
  15. render() {
  16. return (
  17. <div>
  18. <omi-finger onTap={this.handleTap} abc={{a:1}} onSwipe={this.handleSwipe}>
  19. <div class="touchArea" >
  20. {this.data.wording}
  21. </div>
  22. </omi-finger>
  23. </div>
  24. )
  25. }
  26. }
  27. render(<my-app></my-app>, 'body')

支持手势列表:

手势
onTap
onMultipointStart
onLongTap
onSwipe
onPinch
onRotate
onPressMove
onMultipointEnd
onDoubleTap