2015-11-04 132 views
1

在javascript事件中替代touchmove。 我一旦使用touchmove就会收到如下警告。javascript事件中`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. 

请任何帮助。

+0

您使用的离子? –

+0

@NamPham是的,我正在使用离子 –

回答

0

您可以使用内置的离子手势跟踪各种触摸事件,如: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 Site

+0

已经使用过,但仍然有相同的错误。 :( –

+0

什么是你使用的Android版本? –