<ul>
<li v-for="(item,index) in movies" @click="changeColor(index)"
:class="{active:currentIndex===index}">
{{item}}---{{index}}
</li>
</ul>
el:'#app',
data:{
movies: ['七龙珠', '柯南', '你是我的荣耀'],
currentIndex: 0 ,
},
methods:{
changeColor(index){
this.currentIndex=index
}
}