How to add Jitsi Meet to Vuejs

自古美人都是妖i 提交于 2021-01-03 06:17:32

问题


I have loaded the jitsi meet script in the body of my public.html, and i have a component as follows:

<template>
  <div class="container">
    <div id="meet"></div>
  </div>
</template>

<script>
export default {
  name: "ServiceMeet",
  mounted() {
    const domain = "meet.jit.si";
    const options = {
      roomName: "PickAnAppropriateMeetingNameHere",
      width: 700,
      height: 700,
      parentNode: document.querySelector("#meet"),
    };
    const api = new JitsiMeetExternalAPI(domain, options);
    console.log(api.getVideoQuality());
  },
};
</script>

When I try to run I get an error saying 18:21 error 'JitsiMeetExternalAPI' is not defined no-undef, however in the background i can see that the meet is working fine, so I do I fix the error or dismiss it.


回答1:


You could disable the linting error, but I would recommend specifying it as a global variable instead.

.eslintrc.js

module.exports = {
  globals: {
    JitsiMeetExternalAPI: true
  }
}



回答2:


It should work if you prefix the global with window:

const api = new window.JitsiMeetExternalAPI(domain, options);


来源:https://stackoverflow.com/questions/64915112/how-to-add-jitsi-meet-to-vuejs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!