gpt4 book ai didi

javascript - 替代 javascript 事件中的 `touchmove`

转载 作者:行者123 更新时间:2023-11-28 06:44:17 25 4
gpt4 key购买 nike

替代 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.

请提供任何帮助。

最佳答案

您可以使用内置的 ionic 手势来跟踪各种触摸事件,例如:holdtapdoubletapdrag dragstartdragenddragupdragdowndragleft向右拖动滑动向上滑动向下滑动向左滑动向右滑动变换transformstarttransformend旋转捏合捏捏捏出触摸释放

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

使用方法如下:

在您的 Controller 中:注入(inject) $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

关于javascript - 替代 javascript 事件中的 `touchmove`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33522526/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com