vuejs this.posts.$remove(postId) 不是函数

vuejs this.posts.$remove(postId) is not a function

我正在尝试使用 $remove 删除数组元素。但它说 this.posts.$remove 不是函数。谁能解释一下我哪里错了?

<button type="button" class="btn btn-danger" @click="deletePost(post.id)">Xxx</button>

vue 实例:

deletePost(postId){
        console.log(postId);
        this.posts.$remove(postId);
      },

这是我的示例数据

这是我的控制台

我在标签中看到您使用的是 VueJS 2。$remove() 方法已被删除:http://vuejs.org/v2/guide/migration.html#Array-prototype-remove-removed

如迁移指南中所述,您应该只使用 splice() 方法:

methods: {
  removeTodo: function (todo) {
    var index = this.todos.indexOf(todo)
    this.todos.splice(index, 1)
  }
}