var el = document.getElementById('container-id');
el.addEventListener('click', function(e) {
var p = e.target.parentElement;
var index = Array.prototype.indexOf.call(p.children, e.target);
}
I don’t quite understand what you mean. . . . How to load list data without using v-for? To find the node sequence number according to the dom, you must also have the dom node. . .
Just giving you an idea
Where does the index come from without a loop?? Where does the index refer to?
Use native document.queraySelectAlll to give li the same class name to get the li array. Now there is an index
I don’t quite understand what you mean. . . .
How to load list data without using v-for? To find the node sequence number according to the dom, you must also have the dom node. . .