useSupported
SSR 兼容性检测 isSupported
用法
ts
import { useSupported } from '@vueuse/core'
const isSupported = useSupported(() => navigator && 'getBattery' in navigator)
if (isSupported.value) {
// 执行一些操作
navigator.getBattery
}
类型声明
typescript
export declare function useSupported(
callback: () => unknown,
): ComputedRef<boolean>
Source
贡献者
丶远方
Anthony Fu
Fernando Fernández
Jelf
变更日志
v10.0.0-beta.2
on 3/28/2023