How does WeChat Mini Programs get the index of adjacent elements

when the item function is selected in the check box in WeChat Mini Programs"s shopping cart, you need to get the index of the adjacent element and the parent element
now the console.log is undefined

how can I get the index of adjacent elements and parent elements?

the figure is as follows:


Mini Program does not directly support DOM traversal, so the original DOM-based operations are not available.

Mini Program is the MVVM framework, and the original operation can be replaced by data manipulation. In other words, you should calculate the other index you want through the index of the current object.



1.index
2.index 
Menu