<template>
<ul>
<li v-for=“i in 6 ref=“li” @click=“addClass”>элемент списка</li>
</ul>
</template>
<script>
methods: {
addClass() {
const elements = this.$refs.li;
elements.forEach((item) => {
item.classList.toggle(‘active’);
});
}
}
</script>
<template>
<div>
<li v-bind:class="{ active: isActive }" @click="setActive(false)"></li>
<li v-bind:class="{ active: isActive }" @click="setActive(false)"></li>
<li v-bind:class="{ active: isActive }" @click="setActive(false)"></li>
<li v-bind:class="{ active: isActive }" @click="setActive(false)"></li>
</div>
</template>
<script>
...
setActive: function(active){
this.isActive = active;
}
</script>