【问题标题】:Nativescript Swipe can't get directionNativescript Swipe无法获得方向
【发布时间】:2015-10-27 08:14:04
【问题描述】:

我有这个文件来检测滑动的方向。

xml:

<StackLayout orientation="vertical" swipe="onSwipe">
    <Label id='swiped' text='test' />
</StackLayout>

js:

function onSwipe(args) { 
    page = args.object;
    var sb = page.getViewById("swiped");
    sb.text  = 'direction'+ args.direction;
}
exports.onSwipe = onSwipe;

我不确定为什么我无法获取 args.direction。

【问题讨论】:

  • 您能否提供更多有关您使用的 {N} 版本以及您正在测试的设备或模拟器的信息。最新正式版1.4.2,我在刷卡的时候就知道方向了,使用你提供的代码。
  • 我用的是1.4.0 ..这个版本还不支持方向吗?嗯..
  • 其实在1.4.0中取对象有问题,所以可能是这个问题。我建议升级到 1.4.2。
  • 嗯.. 很奇怪,我没有找到方向.. ..我使用的是 iphone4s 模拟器..
  • 我刚刚更改了我之前的评论 :)

标签: xml swipe nativescript


【解决方案1】:

您需要在 XML 声明中启用单元格滚动:swipeCells="true"

<lv:RadListView items="{{ dataItems }}" swipeCells="true" itemSwipeProgressEnded="{{ onSwipeEnded }}">

Telerik 提供的关于获取 x 和 y 方向的教程供将来参考:http://docs.telerik.com/devtools/nativescript-ui/Controls/ListView/listview-features-swipe-to-execute

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-03-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-07-15
    • 2019-05-28
    • 2013-02-04
    • 1970-01-01
    相关资源
    最近更新 更多