Skip to content

usePageLeave

类别
导出体积
576 B
上次更改
2 minutes ago

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

示例

{
  "isLeft": false
}

使用方法

js
import { usePageLeave } from '@vueuse/core'

const isLeft = usePageLeave()

组件使用

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

类型声明

typescript
/**
 * 响应式状态,用于显示鼠标是否离开页面。
 *
 * @see https://vueuse.org/usePageLeave
 * @param options
 */
export declare function usePageLeave(
  options?: ConfigurableWindow,
): Ref<boolean, boolean>

源码

源码演示文档

贡献者

Anthony Fu
一纸忘忧
Anthony Fu
vaakian X
lxhyl
wheat
Alex Kozack
Antério Vieira

更新日志

v9.11.0 on 1/17/2023
d5321 - fix(components): mark defineComponent as pure (#2623)