How to add the same click event to the li in two ul in vue without affecting each other

I want to add a click-to-add class function to the li in both Ul. Now the code clicks on the li, in one ul to add the attribute, but the li with the same subscript in another ul also adds this attribute. How should I write so that the two ul do not affect each other?
the code is as follows:
html:

        <div v-for="items in goodsstandardele">
            <div v-if="items.standarddata[0].url==""" class="species">
                <h5>{{items.standardlabel}}</h5>
                

<span @click="color($index)" :class="{colorDorderRed: $index==colorred}" v-for="(gd,$index) in items.standarddata">{{gd.desc}}</span>

</div> <div v-else class="goods-color"> <h5>{{items.standardlabel}}</h5> <ul> <li @click="color($index)" v-for="(gd,$index) in items.standarddata"> <img :class="{colorDorderRed: $index==colorred}" :src="gd.url" alt="">

{{gd.desc}}

</li> </ul> </div> </div>

js Code:

        color(index){
            this.colorred = index;
          }

the effect is as follows:

clipboard.png
now click on white to jump to 10, blue is 5, no cross-selection is allowed. I don"t understand very well at the beginning of my study. I hope the gods can help me. Thank you!

Feb.28,2021

you pass the index to the function, and judge the ok according to the index


how the code is written, post it to see


Why manipulate nodes? You add a slect attribute to data, and the assignment is empty (I don't know what you mean when you click on a li, under one ul and a li under another ul to add class, and whether the relationship between them is index correspondence or what, let's just follow the index one-to-one correspondence), and then the li in your two ul must be bound by v-for loop. Add a binding event @ click= "tab_index (index)" to each li, such as the index parameter index, of the current li, and bind the li of the loop to the name of the class class you want to add: class= "{'sel':select = = index}". Then, inside the tab_index method in the methods:
tab_index:function (e) {

vm.select = e;

}
see if it's what you want

Menu