uni-app+vue3 videoContext 无效 解决方法

789 阅读1分钟

官网描述

image.png

第二个组件需要传入组件实例, vue2或者小程序中直接传入this

vue3中需要使用到getCurrentInstance来获取当前组件实例

    import { getCurrentInstance } from 'vue'
    const instance = getCurrentInstance()
    const videoContext = uni.createVideoContext('vidoeId', instance)