Skip to content

usePageLeave

Category
Export Size
707 B
Last Changed
4 days ago

Reactive state to show whether the mouse leaves the page.

Demo

{
  "isLeft": false
}

Usage

ts
import { 
usePageLeave
} from '@vueuse/core'
const
isLeft
=
usePageLeave
()

Component Usage

This function also provides a renderless component version via the @vueuse/components package. Learn more about the usage.

vue
<template>
  <UsePageLeave v-slot="{ 
isLeft
}">
Has Left Page: {{
isLeft
}}
</UsePageLeave> </template>

Type Declarations

ts
/**
 * Reactive state to show whether mouse leaves the page.
 *
 * @see https://vueuse.org/usePageLeave
 * @param options
 *
 * @__NO_SIDE_EFFECTS__
 */
export declare function 
usePageLeave
(
options
?:
ConfigurableWindow
,
):
ShallowRef
<boolean, boolean>

Source

SourceDemoDocs

Contributors

NoiseFan

Changelog

No recent changes

Released under the MIT License.