Skip to content

usePageLeave

类别
导出体积
647 B
上次更改
2 months ago

响应式状态,用于显示鼠标是否离开页面。

示例

{
  "isLeft": false
}

使用方法

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

组件使用

vue
<template>
  <UsePageLeave v-slot="{ 
isLeft
}">
是否离开页面: {{
isLeft
}}
</UsePageLeave> </template>

类型声明

ts
export interface UsePageLeaveOptions extends ConfigurableWindow {}
export type 
UsePageLeaveReturn
=
ShallowRef
<boolean>
/** * 响应式状态,用于显示鼠标是否离开页面。 * * @see https://vueuse.org/usePageLeave * @param options * * @__NO_SIDE_EFFECTS__ */ export declare function
usePageLeave
(
options
?: UsePageLeaveOptions,
):
UsePageLeaveReturn

源码

源码演示文档

贡献者

Anthony Fu
一纸忘忧
SerKo
Vida Xie
IlyaL
Fernando Fernández
Anthony Fu
vaakian X
lxhyl
wheat
Alex Kozack
Antério Vieira

更新日志

8c521 - feat(components)!: refactor components and make them consistent (#4912)
d32f8 - refactor: add @__NO_SIDE_EFFECTS__ annotations to all pure functions (#4907)
dd316 - feat: use passive event handlers everywhere is possible (#4477)
0a9ed - feat!: drop Vue 2 support, optimize bundles and clean up (#4349)