ionic 手势事件

事件 描述 用法
on-hold 长按的时间是500毫秒。
1
2
3
4
5
<button
on-hold="onHold()"
class="button">
Test
</button>
on-tap 这个是手势轻击事件,如果长按时间超过250毫秒,那就不是轻击了。。
1
2
3
4
5
<button
on-tap="onTap()"
class="button">
Test
</button>
on-double-tap 手双击屏幕事件
1
2
3
4
5
<button
on-double-tap="onDoubleTap()"
class="button">
Test
</button>
on-touch 这个和 on-tap 还是有区别的,这个是立即执行,而且是用户点击立马执行。不用等待 touchend/mouseup 。
1
2
3
4
<button on-touch="onTouch()"
class="button">
Test
</button>
on-release 当用户结束触摸事件时触发。
1
2
3
4
5
<button
on-release="onRelease()"
class="button">
Test
</button>
on-drag 这个有点类似于PC端的拖拽。当你一直点击某个物体,并且手开始移动,都会触发 on-drag。
1
2
3
4
5
<button
on-drag="onDrag()"
class="button">
Test
</button>
on-drag-up 向上拖拽。
1
2
3
4
5
<button
on-drag-up="onDragUp()"
class="button">
Test
</button>
on-drag-right 向右拖拽。
1
2
3
4
5
<button
on-drag-right="onDragRight()"
class="button">
Test
</button>
on-drag-down 向下拖拽。
1
2
3
4
5
<button
on-drag-down="onDragDown()"
class="button">
Test
</button>
on-drag-left 向左边拖拽。
1
2
3
4
5
<button
on-drag-left="onDragLeft()"
class="button">
Test
</button>
on-swipe 指手指滑动效果,可以是任何方向上的。而且也和 on-drag 类似,都有四个方向上单独的事件。
1
2
3
4
5
<button
on-swipe="onSwipe()"
class="button">
Test
</button>
on-swipe-up 向上的手指滑动效果。
1
2
3
4
5
<button
on-swipe-up="onSwipeUp()"
class="button">
Test
</button>
on-swipe-right 向右的手指滑动效果。
1
2
3
4
5
<button
on-swipe-right="onSwipeRight()"
class="button">
Test
</button>
on-swipe-down 向下的手指滑动效果。
1
2
3
4
5
<button
on-swipe-down="onSwipeDown()"
class="button">
Test
</button>
on-swipe-left 向左的手指滑动效果。
1
2
3
4
5
<button
on-swipe-left="onSwipeLeft()"
class="button">
Test
</button>

$ionicGesture

一个angular服务展示ionicionic.EventController手势。

方法

1
on(eventType, callback, $element)

 在一个元素上添加一个事件监听器。

参数 类型 详情
eventType string

监听的手势事件。

callback function(e)

当手势事件发生时触发的事件。

$element element

angular元素监听的事件。

options object

对象。

1
off(eventType, callback, $element)

在一个元素上移除一个手势事件监听器。

参数 类型 详情
eventType string

移除监听的手势事件。

callback function(e)

移除监听器。

$element element

被监听事件的angular元素。

联系我们

邮箱 626512443@qq.com
电话 18611320371(微信)
QQ群 235681453

Copyright © 2015-2024

备案号:京ICP备15003423号-3