数组遍历取第一条数据

在这里插入图片描述

this.plans = [
       {
    
    
         id: 0,
         name: '小明',
         age: 15
       },
       {
    
    
         id: 1,
         name: '小花',
         age: 20
       },
       {
    
    
         id: 2,
         name: '小天',
         age: 19
       }
     ]
     const [a, ...b] = this.plans
     console.log(a,b)

猜你喜欢

转载自blog.csdn.net/AnnyXSX/article/details/113566828