js怎么根据父级数组下标,去取子级同下标的json数组?不同下标的就删除图片描述
比如我父级数组是0那就拿msg里面下标也是0的数组,下标为1的就删除。
父级数组是1的话就拿msg下标为1的数组,下标为0的就删除,以此类推
<template>
<div class="hello">
<button @click="Btn()">点击</button>
</div>
</template>
<script>
export default {
name: 'HelloWorld',
data() {
return {
dataBox:[{
name:'小明',
msg:[
['信息0','信息0'],
['信息1','信息1'],
]
},
{
name:'小明',
msg:[
['信息0','信息0'],
['信息1','信息1'],
]
},
{
name:'小明',
msg:[
['信息0','信息0'],
['信息1','信息1'],
]
},
{
name:'小明',
msg:[
['信息0','信息0'],
['信息1','信息1'],
]
}],
list:[],
}
},
mounted(){
this.list.push(this.dataBox)
},
methods: {
Btn(){
for(let i=0;i<this.list.length;i++){
//如题
}
}
}
}