我正在使用 Verto library在我基于 Vue-CLI 的项目中 - 我已将所有必需的文件复制到我的 static
文件夹中,并将其直接作为文件导入到我的 index.html
文件中 - 像这样:
<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>
在我的组件的方法中,我有这样的东西:
connectAudio () {
/* eslint-disable new-cap */
const verto = new jQuery.verto({
...
但是一旦我执行它,我就会收到一个错误:“TypeError:jQuery.verto 不是构造函数”
有人可以帮我解决这个问题吗?
最佳答案
确保您按照文档的建议在 verto init 回调中调用 new jQuery.verto({})
。
示例:$.verto.init({}, function(){ ... new jQuery.verto({...}) ... })
。
不确定您是否已经这样做了,我无法通过您共享的代码片段来判断。
关于javascript - jQuery.verto 不是构造函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50910562/