DEV Community

HarmonyOS
HarmonyOS

Posted on

[Sports Watch] [API 6] How to retrieve the values of direction and item simultaneously for the onswipe event of list-item ...

Read the original article:[Sports Watch] [API 6] How to retrieve the values of direction and item simultaneously for the onswipe event of list-item component

Question:

How to retrieve the values of direction and item simultaneously for the onswipe event of list-item component?

Solution:

<!-- index.hml -->
<div class="container">
  <list class="todo-wraper">
    <list-item for="{{todolist}}" class="todo-item" onswipe="handleItem($item)>
      <text class="todo-title">{{$item.title}}</text>
      <text class="todo-title">{{$item.date}}</text>
    </list-item>
  </list>
</div>Copy codeCopy code
handleItem(item,e){
    console.info("direction " + e.direction + " item " + item)
}
Enter fullscreen mode Exit fullscreen mode

Written by Jeorge Kiryienko

Top comments (0)