javascript - vue v-for loop, the key value of the parent loop needs to be obtained in the sub-loop, how to do it?
某草草
某草草 2017-06-26 10:56:33
0
2
1048

Using vue_2.20
v-for loop, the key value of the parent loop needs to be obtained in the sub-loop,
The data structure is as follows

data:{
    key1:[
    {a:'x',b:'y'},
    {a:'x',b:'y'}
    ],
    key2:[
    {a:'x',b:'y'},
    {a:'x',b:'y'}
    ]
}
<p v-for="(value, key, index) in data">
<p v-for="(value_c, key_c, index_c) in value" onclick="vm.getmydata(key,key_c)"></p>
</p>

The inner layer wants to click to get the corresponding parent key and child index, so as to obtain the information corresponding to p.

某草草
某草草

reply all(2)
某草草

Okay, I found the problem, just replace onclick with v-on:click binding event -=

给我你的怀抱

Loop data? And it’s still an object

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template