<div id="app">
<div class="container">
<ul class="title flex">
<li
v-for="(item,index) in titles"
@click="active=index"
:class="{active:index===active}"
>
{{item}}
</li>
</ul>
<ul>
<li v-show="active===0">11</li>
<li v-show="active===1">22</li>
<li v-show="active===2">33</li>
</ul>
</div>
</div>
@click
是v-on:click
的缩写,指令绑定是表达式,不一定非得是方法哦