【问题标题】:How To Access Firebase Databese add?如何访问 Firebase 数据库添加?
【发布时间】:2021-07-24 10:46:27
【问题描述】:

我在网络应用用户数据存储中工作。我在连接firebasae cloudhost上的数据库时遇到了这个问题,然后这段代码解决了这个问题。我正在编写代码。`在此处输入代码


const tableUser =document.querySelector('.table-users')

const renderUser=doc => {
const tr =`
<tr data-id=${doc.id}>
<td>${doc.data().FristName}</td>
<td>${doc.data().LastName}</td>
<td>${doc.data().Phone}</td>
<td>${doc.data().Email}</td>
<td>
    <button class="btn btn-edit">Edid</button>
    <button class="btn btn-delete">Delete</button>
</td>
</tr>`;
tableUser.insertAdjacentHTML('beforeend',tr);


db.collection('users').get().then(querySnapshot =>{
    querySnapshot.forEach(doc =>{
        renderUser(doc)

    });
});



addModalform.addEventListener('submit',e =>{
e.preventDefault();
db.collection('users').add({
    FristName:addModalform.FristName.value,
    LastName:addModalform.LastName.value,
    Phone:addModalform.Phone.value,
    Email:addModalform.Email.value,
});
});````
That the code in write in Solve that my Connection Firebase,I hope help all are tham. 

【问题讨论】:

  • 你能解释一下是什么问题吗?

标签: javascript json firebase firebase-realtime-database


【解决方案1】:

我的问题是我没有 Confram 连接我的 firebase 数据库,那么写入它的这段代码就可以解决这个问题。现在我正在剪切 js 代码,然后它正在工作

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-14
    • 2017-12-29
    • 1970-01-01
    • 2018-08-06
    • 2020-06-21
    • 2017-04-18
    相关资源
    最近更新 更多