我在我的Firebase中有许多电报键盘,我想要得到用户单击的特定键盘的孩子,
msg.text是我键盘上的变量
const ref = db.ref('Keyboards/Keyboard1/childs'); //keyboard 1
const ref = db.ref('Keyboards/Keyboard2/childs'); //keyboard 2
const ref = db.ref('Keyboards/Keyboard3/childs'); //keyboard 3如何添加Keyboard[n],我的意思是msg.text在我的ref中
如果我输入的msg.text = Keyboard1,我得到了Keyboard1 Childs .
,它没有工作,
const ref = db.ref('Keyboards/msg.text/childs');注意到当我的项目是本地的json时,我使用了下面的代码来处理这个问题,并且工作很好:
locale.keyboards[msg.text].childs
发布于 2017-08-12 20:29:22
你可以试着像下面这样做。
db.ref('Keyboards/' + msg.text + '/childs');https://stackoverflow.com/questions/45654513
复制相似问题