Merge pull request #3374 from cky917/2.0

delete: collapse组件不需要的代码
This commit is contained in:
Aresn 2018-04-16 09:53:50 +08:00 committed by GitHub
commit b51a3861fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 48 additions and 35 deletions

View file

@ -1,4 +1,5 @@
<template> <template>
<div>
<Collapse accordion v-model="value3"> <Collapse accordion v-model="value3">
<Panel name="1"> <Panel name="1">
史蒂夫·乔布斯 史蒂夫·乔布斯
@ -25,14 +26,33 @@
<p slot="content">乔纳森·伊夫是一位工业设计师现任Apple公司设计师兼资深副总裁英国爵士他曾参与设计了iPodiMaciPhoneiPad等众多苹果产品除了乔布斯他是对苹果那些著名的产品最有影响力的人</p> <p slot="content">乔纳森·伊夫是一位工业设计师现任Apple公司设计师兼资深副总裁英国爵士他曾参与设计了iPodiMaciPhoneiPad等众多苹果产品除了乔布斯他是对苹果那些著名的产品最有影响力的人</p>
</Panel> </Panel>
</Collapse> </Collapse>
<br/>
<br/>
<Collapse v-model="value5">
<Panel name="21">
斯蒂夫·盖瑞·沃兹尼亚克
<p slot="content">斯蒂夫·盖瑞·沃兹尼亚克Stephen Gary Wozniak美国电脑工程师曾与史蒂夫·乔布斯合伙创立苹果电脑今之苹果公司斯蒂夫·盖瑞·沃兹尼亚克曾就读于美国科罗拉多大学后转学入美国著名高等学府加州大学伯克利分校UC Berkeley并获得电机工程及计算机EECS本科学位1987</p>
</Panel>
<Panel name="22">
乔纳森·伊夫
<p slot="content">乔纳森·伊夫是一位工业设计师现任Apple公司设计师兼资深副总裁英国爵士他曾参与设计了iPodiMaciPhoneiPad等众多苹果产品除了乔布斯他是对苹果那些著名的产品最有影响力的人</p>
</Panel>
<Panel name="23">
乔纳森·伊夫
<p slot="content">乔纳森·伊夫是一位工业设计师现任Apple公司设计师兼资深副总裁英国爵士他曾参与设计了iPodiMaciPhoneiPad等众多苹果产品除了乔布斯他是对苹果那些著名的产品最有影响力的人</p>
</Panel>
</Collapse>
</div>
</template> </template>
<script> <script>
export default { export default {
data () { data () {
return { return {
value3: '1', value3: ['1', '2', '3'],
value4: '1-1' value4: '1-1',
} value5: ['21', '22', '23']
} };
} }
};
</script> </script>

View file

@ -36,15 +36,8 @@
this.$children.forEach((child, index) => { this.$children.forEach((child, index) => {
const name = child.name || index.toString(); const name = child.name || index.toString();
let isActive = false;
if (self.accordion) { child.isActive = activeKey.indexOf(name) > -1;
isActive = activeKey === name;
} else {
isActive = activeKey.indexOf(name) > -1;
}
child.isActive = isActive;
child.index = index; child.index = index;
}); });
}, },