Skip to content

useOnline

Category
Export Size
900 B
Last Changed
3 hours ago

响应式的在线状态。是 useNetwork 的封装。

Demo

请断开网络查看更改
状态:Online

使用方法

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

const online = useOnline()

组件使用

vue
<template>
  <UseOnline v-slot="{ isOnline }">
    是否在线: {{ isOnline }}
  </UseOnline>
</template>

Type Declarations

typescript
/**
 * 响应式在线状态。
 *
 * @see https://vueuse.org/useOnline
 * @param options
 */
export declare function useOnline(
  options?: ConfigurableWindow,
): Readonly<ShallowRef<boolean>>

Source

SourceDemoDocs

Contributors

jorshen

Changelog

No recent changes

Released under the MIT License.