Skip to content
目录

LongPressEvent

长按事件。

属性

属性名类型说明示例
typestring事件类型type: 'longPress'
statenumber手势状态state: 0 // normal
state: 1 // began
state: 2 // changed
state: 3 // ended
state: 4 // cancelled
timestampnumber时间戳timestamp: 1578973450142
positionObject点击位置(单位:dp或pt)position: {x: 111.1, y: 222.2}

示例


Tenon Vue

html
<!-- App.vue-->
<template>
  <view @longPress="handleLongPress">
    <text>LongPress Demo</text>
  </view>
</template>
<script>
  export default {
    methods: {
      handleLongPress(){
        Toast.show('LongPress')
      }
    }
  }
</script>

Tenon React

jsx
import React from "react"

import Tenon from "@hummer/tenon-react"

function App() {
  function handleLongPress(){
    Toast.show('LongPress')
  }
  return (
    <view onLongPress={handleLongPress}>
      <text>LongPress Demo</text>
    </view>
  );
}

Tenon.render(<App/>)