我push
将ROOMS
对象放入我的.on("child_added", ....)
数组Player
,如下所示。该对象的一个部分是其他对象的数组(id
obj,它具有一些属性,如name
,ROOMS.players
等等。如何分配给snap.child("players").val()
,因为EXCEPTION: Error trying to diff '[object Object]'
不起作用(snap.child("players").val()
)-rooms
-id
-name
-isRoomFull
+board
-players
-kEFvdfeff84fdfdff
-id
-name
-kEFvd4545dfjh9fvv
-id
-name
getRooms() {
this.roomsRef.on("child_added", function(snap) {
ROOMS.push({
id: snap.child("id").val(),
name: snap.child("name").val(),
players: [], //how to assign to this property
isRoomFull: snap.child("isRoomFull").val(),
board: snap.child("board").val(),
})
});
结构如下所示:
var lmp = 5,
lma = 0;
$(window).scroll(function() {
if ($(document).height() - 50 <= $(window).scrollTop() + $(window).height()) {
$('.div').append('<div></div><div></div><div></div><div></div><div></div>');
lmp++;
lma++;
console.log(lmp + " : " + lma);
}
});
答案 0 :(得分:0)