jQuery.verto is not a constructor

谁说我不能喝 提交于 2019-12-11 16:06:04

问题


I'm using a Verto library in my Vue-CLI based project - I've copied all necessary files to my static folder and imported it directly as a files in my index.html file - something like this:

<script src="static/js/jquery.min.js"></script> // I've also tried with including jQuery in webpack config, but with the same result
<script src="static/js/jquery.json.min.js"></script>
<script src="static/js/jquery.verto.js"></script>
<script src="static/js/jquery.FSRTC.js"></script>
<script src="static/js/jquery.jsonrpcclient.js"></script>

And in my component's methods I have something like this:

connectAudio () {
  /* eslint-disable new-cap */
  const verto = new jQuery.verto({
  ...

But once I execute it, I receive an error: "TypeError: jQuery.verto is not a constructor"

Can someone help me with this?


回答1:


Make sure you're calling new jQuery.verto({}) inside the verto init callback as the docs suggest.

Example: $.verto.init({}, function(){ ... new jQuery.verto({...}) ... }).

Not sure if you're already doing it, I can't tell by the code snippet you shared.



来源:https://stackoverflow.com/questions/50910562/jquery-verto-is-not-a-constructor

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