2015-11-04 66 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版本? –