omi-finger
针对移动端,负责的手势交互,我们也提供了 omi-finger 手势交互库。你可以移动端打开这个页面看看 omi-finger 的能力:
使用:
import { render, tag, WeElement, observe } from 'omi'
import 'omi-finger'
@observe
@tag('my-app')
class MyApp extends WeElement {
install() {
this.data.wording = 'Tap or Swipe Me!'
}
handleTap = (evt) => {
this.data.wording += '\r\nTap'
}
handleSwipe = (evt) => {
this.data.wording += '\r\nSwipe-' + evt.direction
}
render() {
return (
<div>
<omi-finger onTap={this.handleTap} abc={{a:1}} onSwipe={this.handleSwipe}>
<div class="touchArea" >
{this.data.wording}
</div>
</omi-finger>
</div>
)
}
}
render(<my-app></my-app>, 'body')
支持手势列表:
手势 |
---|
onTap |
onMultipointStart |
onLongTap |
onSwipe |
onPinch |
onRotate |
onPressMove |
onMultipointEnd |
onDoubleTap |