更新记录
1.0.0(2020-12-02) 下载此版本
初次上传
平台兼容性
collapseItem
Project setup
基本使用:
<div style='padding:0 30rpx;'
v-for="(item, index) in dataAll"
@click="openDetail(index)"
:key="index">
<collapse-item :collapseName="item.name"
:data="item"
:ref="'collapse'+index">
<template v-slot:content>
<div>
基本使用
</div>
</template>
</collapse-item>
</div>
<script>
import collapseItem from "@/components/yixiao-collapseItem/yixiao-collapseItem";
export default {
components: {
collapseItem
},
data () {
return {
lastIndex: 1,
dataAll: [
{name:'测试1号'},
{name:'测试2号'},
{name:'测试3号'},
{name:'测试4号'},
],
}
},
methods: {
//手风琴
openDetail (index) {
console.log(index);
if (index != this.lastIndex && this.lastIndex >= 0) {
this.$refs["collapse" + this.lastIndex][0].isOpen = false;
this.$refs["collapse" + index][0].isOpen = !this.$refs[
"collapse" + index
][0].isOpen;
} else {
this.$refs["collapse" + index][0].isOpen = !this.$refs[
"collapse" + index
][0].isOpen;
}
this.lastIndex = index;
},
}
}
</script>