Firebase:在不知道关键的情况下获得孩子的价值 [英] Firebase: getting value of a child without knowing its key
本文介绍了Firebase:在不知道关键的情况下获得孩子的价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在不知道子元素键的情况下获取子元素的值?下面的示例数据结构;
How can I get the value of a child element without knowing the key of that child element? Example data structure below;
->cars
-->3282jasjd893j: doors
-->819idid82jkdf: windows
-->fjf842jr8448r: audi
我需要在不知道键的情况下获取值"doors","windows","audi".
I need to get the values "doors", "windows", "audi", without knowing the keys.
任何建议将不胜感激!
推荐答案
非常感谢您提出的所有意见和建议.我现在已经有了答案,这里是:
Thanks a lot for all your comments and advice. I've got the answer now, and here it is:
let inputArray = [];
snapshot.forEach(snap => {
inputArray.push(snap.val());
return false;
});
这篇关于Firebase:在不知道关键的情况下获得孩子的价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文