<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="vue.js" type="text/javascript"></script>
<style type="text/css">
.active{
color: red;
}
</style>
</head>
<body>
<!--修饰符-->
<div id="app">
<ul>
<li v-for="(item ,index) in items" :class="{active:currentIndex===index}" @click="lilick(index)">{{item}}</li>
</ul>
</div>

<script>
const app=new Vue({
el:'#app',
data:{
message:"hello" ,
items:[ "haha",
'asda',
'asdfasd',
'asddddd'],
currentIndex:-1
},
methods:{
lilick(index){
this.currentIndex=index;
}
}

})

</script>
</body>
</html>