diff --git a/packages/collapse-item/index.js b/packages/collapse-item/index.js index 208e828df..3b93c95a8 100644 --- a/packages/collapse-item/index.js +++ b/packages/collapse-item/index.js @@ -96,7 +96,10 @@ export default sfc({ } const { parent } = this; - const name = parent.accordion && this.currentName === parent.value ? '' : this.currentName; + const name = + parent.accordion && this.currentName === parent.value + ? '' + : this.currentName; const expanded = !this.expanded; this.parent.switch(name, expanded); }, @@ -111,15 +114,28 @@ export default sfc({ }, render(h) { + const titleSlots = CELL_SLOTS.reduce( + (slots, name) => { + if (this.slots(name)) { + slots[name] = () => this.slots(name); + } + return slots; + }, + { + default: () => this.slots('value') + } + ); + const Title = ( - {this.slots('value')} - {CELL_SLOTS.map(slot => h('template', { slot }, this.slots(slot)))} - + /> ); const Content = this.inited && (