“删除”功能无法正常工作

时间:2018-06-26 13:32:22

标签: node.js mongodb express vue.js

我正在按照本教程https://medium.com/@anaida07/mevn-stack-application-part-1-3a27b61dcae0来学习如何使用MEVN。

我基本上使用了教程中的确切代码,但是我没有使用教程中使用的async / await函数。一切正常,但删除功能正常。删除在我的控制台中可以识别,但是实际上并没有从表中删除行。我已经在下面发布了我的删除功能,以及指向我所引用示例中的相同功能的样板链接。任何帮助将不胜感激。

deletePost (id) {
  const $this = this
  this.getPosts()
  $this.$swal({
    title: 'Are you sure?',
    text: "You won't be able to revert this!",
    type: 'warning',
    showCancelButton: true,
    confirmButtonColor: '#3085d6',
    cancelButtonColor: '#d33',
    confirmButtonText: 'Yes, delete it!'
  }).then(function () {
    PostsService.deletePost(id)
    $this.$router.go({
      path: '/'
    })
  })
}

https://github.com/anaida07/MEVN-boilerplate/blob/master/client/src/components/Posts.vue

0 个答案:

没有答案
相关问题