通过 VueUse usePermission来 Vue 判断有没有相机、陀螺仪、麦克风等 api 权限。
import { usePermission } from '@vueuse/core'
//判断有没有麦克风权限
const microphoneAccess = usePermission('microphone')
import { computed, reactive } from 'vue'
import { usePermission } from '@vueuse/core'
//加速计权限
const accelerometer = usePermission('accelerometer')
//可访问性事件权限
const accessibilityEvents = usePermission('accessibility-events')
//光传感器权限
const ambientLightSensor = usePermission('ambient-light-sensor')
//后台运行权限
const backgroundSync = usePermission('background-sync')
//拍照权限
const camera = usePermission('camera')
//剪贴板读取权限
const clipboardRead = usePermission('clipboard-read')
//剪贴板写入权限
const clipboardWrite = usePermission('clipboard-write')
//陀螺仪权限
const gyroscope = usePermission('gyroscope')
//磁力计传感器权限
const magnetometer = usePermission('magnetometer')
//麦克风权限
const microphone = usePermission('microphone')
//通知权限
const notifications = usePermission('notifications')
//W3C付款请求权限
const paymentHandler = usePermission('payment-handler')
//持久化权限
const persistentStorage = usePermission('persistent-storage')
//推送权限
const push = usePermission('push')
//扬声器权限
const speaker = usePermission('speaker')
例子