1
'child_added'工作正常,但'child_removed'不起作用。Firebase'child_removed'事件偵聽器不工作
數據索引是「.indexOn」:「status」。
火力地堡數據
{ "user uid" : { "-Kb8FSBMOvcposJ-iJYL" : { "createDate" : 1485140252291, "message" : "login", "response" : "none", "status" : "0", "title" : "8. sign-in" }, "-KbL6d1xrfqCBAcP7_Qu" : { "createDate" : 1485356045006, "message" : "logout", "response" : "none", "status" : "1", "title" : "sign-out" } } }
火力地堡事件偵聽器
var notiRef = firebase.database().ref('message/' + user.uid); notiRef.orderByChild('status').equalTo('wait').on('child_added', function(snapshot) { //do something... }); notiRef.orderByChild('status').equalTo('wait').on('child_moved', function(snapshot) { // not worked. }); firebase.database().ref('notification/' + user.uid + '/uid').on('child_moved', function(snapshot) { // not worked. }); notiRef.on('child_moved', function(snapshot) { // not worked. });
所有這三個在上面的代碼 'child_removed' 將無法正常工作。 設置ref目標是否存在問題?或者它是否與設置indexOn有關? (設置indexOn是必需的)
這是我的錯誤。 思想被「移除」,但打字被「移動」。 謝謝。 – user7354286