<divid="app"><divclass="tab"><ul><liv-on:click='handle(index)'v-bind:class='currentIndex==index?"active":""'v-bind:key='item.id'v-for='(item,index) in list'>{{item.title}}</li></ul><divv-for='(item,index) in list'v-bind:class='currentIndex==index?"current":""'><img:key='item.id':src="item.path"alt=""></div></div></div>
var vm =newVue({
el:'#app',
data:{
currentIndex:0,
list:[{
id:1,
title:'apple',
path:'images/apple.jpg'},{
id:2,
title:'orange',
path:'images/orange.jpg'},{
id:3,
title:'lemon',
path:'images/lemon.jpg'}]},
methods:{
handle:function(index){// 在这里实现选项卡的切换操作:本质就是通过currentIndex判断等于哪个index操作类名// index上面触发函数时传过来this.currentIndex=index;}}});