vue de-emphasis array

Usage scenarios:
When you add a comment to review the list after an asynchronous synchronization, paging case if there is too much data, by the Raja upload data may appear to return data back and repeat the current list

 <div   v-for="(item,index) in reduce(list)" :key="index"  :item="item" >
 </div>
...
  methods: {
    reduce(arr) {
      const res = new Map();
      return arr.filter(arr => !res.has(arr._id) && res.set(arr._id, 1));
    }
...
Published 41 original articles · won praise 4 · Views 4600

Guess you like

Origin blog.csdn.net/lucasxt/article/details/104772103