主题
useSupported
SSR 兼容性 isSupported
¥SSR compatibility isSupported
用法
¥Usage
ts
import { useSupported } from '@vueuse/core'
const isSupported = useSupported(() => navigator && 'getBattery' in navigator)
if (isSupported.value) {
// do something
navigator.getBattery
}
类型声明
typescript
export declare function useSupported(
callback: () => unknown,
): ComputedRef<boolean>