Skip to content

⬅️ Back to Table of Contents

📄 demo.vue

📊 Analysis Summary

Metric Count
🔧 Functions 3
📦 Imports 2
📊 Variables & Constants 3

📚 Table of Contents

🛠️ File Location:

📂 packages/core/onLongPress/demo.vue

📦 Imports

Name Source
onLongPress @vueuse/core
shallowRef vue

Variables & Constants

Name Type Kind Value Exported
htmlRef number let/var shallowRef<HTMLElement | null>(null)
htmlRefOptions number let/var shallowRef<HTMLElement | null>(null)
htmlRefOnMouseUp number let/var shallowRef<HTMLElement | null>(null)

Functions

onLongPressCallback(e: PointerEvent): void

Code
function onLongPressCallback(e: PointerEvent) {
  longPressed.value = true
}
  • Parameters:
  • e: PointerEvent
  • Return Type: void

onMouseUpCallback(duration: number, distance: number, isLongPress: boolean): void

Code
function onMouseUpCallback(duration: number, distance: number, isLongPress: boolean) {
  if (!isLongPress)
    clicked.value = true

  console.log({ distance, duration, isLongPress })
}
  • Parameters:
  • duration: number
  • distance: number
  • isLongPress: boolean
  • Return Type: void
  • Calls:
  • console.log

reset(): void

Code
function reset() {
  longPressed.value = false
  clicked.value = false
}
  • Return Type: void