VUEJS remove Element From Lists?

后端 未结 5 2112
渐次进展
渐次进展 2021-01-31 02:36

it is possible to remove specific element from lists. i tried this functions for remove element

pop() = remove last element

$remove(index) = n

5条回答
  •  眼角桃花
    2021-01-31 03:24

    $remove is deprecated in Vue.js 2.0 and replaced by splice as stated in the docs. Make sure you add the 2nd parameter of splice for it to work.

    Migration From Vue 1.x - 2.0

    methods: {
      removeElement: function (index) {
        this.items.splice(index, 1);
      }
    }
    

提交回复
热议问题