用uniapp 开发微信小程序、app,如何在vue页面引入下面的strophe.min.js并使用????
<html>
<head>
<script src='http://cdn.bootcss.com/jquery/1.9.1/jquery.min.js'></script>
<script src='http://cdn.bootcss.com/strophe.js/1.1.3/strophe.min.js'></script>
<script src='test.js'></script>
</head>
<body>
JID:<input type="text" id="input-jid">
<br>
密码:<input type="password" id="input-pwd">
<br>
<button id="btn-login">登录</button>
<div id="msg" style="height: 400px; width: 400px; overflow: scroll;"></div>
我新建了一个js文件,访问strophe.js那个路径,然后全选复制进去,再在vue页面import:
import Strophe from '@/js_sdk/strophe/strophe.js'
然后在使用Strophe:this.connection = new Strophe.Connection(this.BOSH_SERVICE)
运行报错:
TypeError: Cannot set property 'Strophe' of undefined
请问是不能这样用吗?正确的改怎么操作?
以何为家 (作者)
不行呀兄弟,一进页面还是提示TypeError: Cannot set property 'Strophe' of undefined
2021-05-20 18:32