0
林不知道它是如何调用,但我只是想推像数据:火力地堡推多发对象的钥匙
通过使用.push()
{
'{this_should_be_a_key}' : {
name : '',
items : {
'{this_should_be_a_key}' : {
title : ''
}
}
}
}
现在我做这样的事情:应该不错与承诺
ref.push({
'name' : ''
}).then(function(snapshot) {
let key = snapshot.key;
ref.child(key+'/items').push({
title : ''
});
}).catch(function(err) {
console.log(err);
});
这我有推2次,任何更简单的方法或其可能只推一次?如..
ref.push({
'name' : '',
'items' : {
'{this_should_be_a_key}' {
'title' : ''
}
}
}).then(function(snapshot) {
alert('done');
}).catch(function(err) {
console.log(err);
});
谢谢! ,'ref.push().key'这将是唯一的ID权利? – l2aelba
是的,很多:https://gist.github.com/mikelehen/3596a30bd69384624c11 – cartant