问题描述
我正在使用 Verto库基于Vue-CLI的项目-我已将所有必需的文件复制到我的static
文件夹中,并将其作为文件直接导入到我的index.html
文件中-像这样:
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({
...
但是一旦执行它,我会收到一个错误:"TypeError: jQuery.verto is not a constructor"
But once I execute it, I receive an error: "TypeError: jQuery.verto is not a constructor"
有人可以帮我吗?
推荐答案
请确保按照文档建议在verto init回调内调用new jQuery.verto({})
.
Make sure you're calling new jQuery.verto({})
inside the verto init callback as the docs suggest.
例如:$.verto.init({}, function(){ ... new jQuery.verto({...}) ... })
.
不确定您是否已经在做,我不能通过共享的代码段来区分.
Not sure if you're already doing it, I can't tell by the code snippet you shared.
这篇关于jQuery.verto不是构造函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!