从Firestore删除数据库条目

This is the final article from the short Vue and Firestore series. In this article, we will delete the entries from our Firestore database.

这是简短的Vue和Firestore系列的最后一篇文章。 在本文中,我们将从Firestore数据库中删除条目。

介绍 (Introduction)

We have created our app, created a database, configured that database to run in the app, sent our notes to the database, and also fetched notes from the database.

我们已经创建了应用程序,创建了数据库,配置了该数据库以在应用程序中运行,将注释发送到数据库,还从数据库中获取了注释。

We can create new notes which are stored in a database so we don’t lose our notes when we refresh the page. But we don’t have a way to delete any notes. Let’s make that happen.

我们可以创建存储在数据库中的新笔记,因此刷新页面时不会丢失笔记。 但是我们没有办法删除任何笔记。 让我们做到这一点。

添加按钮以删除笔记 (Adding a button to delete notes)

We will add a button beside each note. Clicking that button will run a method that will remove the note from our notes array and will then delete that note from the database.

我们将在每个音符旁边添加一个按钮。 单击该按钮将运行一种方法,该方法将从notes数组中删除便笺,然后从数据库中删除该便笺。

We have to remove it from the notes array as well as the database since even though it's removed from the database, it will still show on our screen until we refresh the page. Only after we refresh the page, will the array be populated with the notes in the database and reflect our changes.

我们必须将其从notes数组以及数据库中删除,因为即使将其从数据库中删除,它仍然会显示在屏幕上,直到刷新页面为止。 只有刷新页面后,阵列中的注释才会填充到数据库中,并反映出我们的更改。

So removing it from the array will make su

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值