繁体   English   中英

在JavaScript事件中替代`touchmove`

[英]Alternate for `touchmove` in javascript event

替代JavaScript事件中的touchmove 一旦使用touchmove收到如下警告。

'Touch.webkitRadiusX' is deprecated and will be removed in M47, around November 2015. Please use 'Touch.radiusX' instead.
ionic.js:1155 'Touch.webkitRadiusY' is deprecated and will be removed in M47, around November 2015. Please use 'Touch.radiusY' instead.
ionic.js:1155 'Touch.webkitRotationAngle' is deprecated and will be removed in M47, around November 2015. Please use 'Touch.rotationAngle' instead.
ionic.js:1155 'Touch.webkitForce' is deprecated and will be removed in M47, around November 2015. Please use 'Touch.force' instead.

请帮忙。

您可以使用内置的离子手势跟踪各种触摸事件,例如: holdtapdoubletapdragdragstartdragenddragupdragdowndragleftdragrightswipeswipeupswipedownswipeleftswiperighttransformtransformstarttransformendrotatepinchpinchinpinchouttouchrelease

就您而言,我认为touchmove可以替换为drag事件。 此事件为您返回x,y。

这是使用方法:

在您的控制器中:注入$ionicGesture依赖项。

myApp.controller('myCtrl', ['$ionicGesture', function($ionicGesture){
    $ionicGesture.on('drag', function (e) {
        //Your logic here.
        //You can use console.log(JSON.stringify(e, null, 2)) to check the object (x,y coors)
    })
}]);

Ionic Docs网站上了解更多详细信息

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM