const {ccclass, property} = cc._decorator; @ccclass export default class NetStuidy extends cc.Component { start () { let xhr = new XMLHttpRequest() xhr.onreadystatechange = ()=>{ if(xhr.readyState == 4 && (xhr.status >= 200 && xhr.status < 400)){ console.log(xhr.responseText) } } xhr.open("GET","http://www.baidu.com",true) xhr.send() } }