onload函数下定义的socket客户端
var array=[];
var polist=this.pokelist.pokes;
var socket=io.connect(‘127.0.0.1:3000’);
socket.on(‘event1’,function(msg){
var camsg=msg.split(",");
for(var i=0;i<camsg.length;i++){
array[i]=polist[camsg[i]];
}
// 这里cc.log(this.pokelist)无法读取节点组件属性的值 //undifined
})
cc.log(array.length); //结果为0
也就是说socket.on的回调函数中所操作的数据,传递不出来?那怎么根据服务器发来的信息,对节点或者其他数据进行操作呢
有没有知道,是不是出什么bug了
let self = this 然后里面用self.handpoke
请问一下,问题解决了吗
