点击我想扩展特定的ul,但它正在扩展每个ul.i'm无法定位单个ul。
.ul {
list-style: none;
right: 25px;
bottom: 10px;
height: 60px;
overflow: hidden;
width: 200px;
border-bottom: 1px solid #cfdada;
}
.landingPage ul.activeClass {
overflow: auto;
}
<div class="pageContent" v-for="(item,index) in dataBox[selectedTab]">
<span v-for="(e,i) in dataBox[selectedTab][index]">
<h4>{{i}}</h4>
<ul v-bind:class="{activeClass:isActive}">
<li v-for="m in e">{{m.name}}</li>
</ul>
<span v-if="!isActive" v-on:click="{isActive=!isActive}" class="moreIcon">More..</span>
</span>
</div>
答案 0 :(得分:0)
isActive
应设置为每个对象e
,您应该像这样更改代码:
computed: {
activeDataBox () {
return this.dataBox.map(e => {
e.isActive = false
return e
})
}
}
&#13;
<div class="pageContent" v-for="(item,index) in activeDataBox[selectedTab]">
<span v-for="(e,i) in activeDataBox[selectedTab][index]">
<h4>{{i}}</h4>
<ul v-bind:class="{activeClass:e.isActive}">
<li v-for="m in e">{{m.name}}</li>
</ul>
<span v-if="!e.isActive" v-on:click="{e.isActive=!e.isActive}" class="moreIcon">More..</span>
</span>
</div>
&#13;