Elementui中折叠面板默认设置为展开
1.Elementui中折叠面板默认设置为展开
当el-collapse 中v-model的值和唯一标识name一样的时候,会使其默认展开(代码如下)
<el-collapse accordion v-model="activeName01" @change="handleChange">
<el-collapse-item name="1">
<template slot="title" >
<h3>投放应用</h3>
</template>
<div class="banking">
<span v-for="(item,index) in versionlist" :style="{background:(index==isactive ? item.color:''),color:(index== isactive ? 'white':'')}" @click='switchtab(item.value, index)' :key="index">{{item.name}}</span>
</div>
</el-collapse-item>
</el-collapse>
<script>
data:function(){
return{
activeName01:'1' //默认collapse是展开状态
}
}
</script>
2.当在Elementui中需要给collapse子元素el-collapse-item中的title加样式时可以用
<template slot = "title">
<h3>这是用slot替换一般直接在控件中title中写内容的模式</h3>
</template>