uni-app EventSource连接手机调试报错 Cannot read property 'EventSource' of undefined

uni-app EventSource连接手机调试报错 Cannot read property ‘EventSource’ of undefined

项目 内容
PC开发环境操作系统 Windows
PC开发环境操作系统版本号 Windows 10 企业版 LTSC
HBuilderX版本号 3.2.16

bug描述:

在web端调试的时候 使用EventSource没问题 但是连接手机调试的却报错 “TypeError: Cannot read property ‘EventSource’ of undefined”

示例代码:

self.source = new window.EventSource('http://localhost:9000/web/sse/start?clientId=' + this.randNum);

更多关于uni-app EventSource连接手机调试报错 Cannot read property 'EventSource' of undefined的实战教程也可以访问 https://www.itying.com/category-93-b0.html

7 回复

加个判断 if(typeof (EventSource) !== ‘undefined’) { //支持eventSource
}

更多关于uni-app EventSource连接手机调试报错 Cannot read property 'EventSource' of undefined的实战教程也可以访问 https://www.itying.com/category-93-b0.html


您好 谢谢回复 但是在前端我是加了这个判断的 现在的问题是利用hbuilder做手机app开发 是不是不支持evensource这个方法呢

开发过程中发现的

之前你私信过我,但我没权限私信你,所以在这里回复你。

请问解决了,麻烦告知下呢,跪求

请问能解决吗

你好,请问解决了吗

回到顶部