LongPressEvent
长按事件。
属性
| 属性名 | 类型 | 说明 | 示例 |
|---|---|---|---|
| type | string | 事件类型 | type: 'longPress' |
| state | number | 手势状态 | state: 0 // normalstate: 1 // beganstate: 2 // changedstate: 3 // endedstate: 4 // cancelled |
| timestamp | number | 时间戳 | timestamp: 1578973450142 |
| position | Object | 点击位置(单位: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/>)