Skip to content

Commit fa26d9b

Browse files
committed
fix(QBreadcrumbEl): Work with scoped slots instead of slots
1 parent 92b3eb0 commit fa26d9b

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

dev/components/components/breadcrumbs.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@
2020
</q-breadcrumbs>
2121
<br><br>
2222
<q-breadcrumbs align="center">
23-
<q-icon name="trending_flat" slot="separator" />
23+
<q-icon name="trending_flat" slot="separator" slot-scope="props" />
2424
<q-breadcrumb-el active>Home</q-breadcrumb-el>
2525
<q-breadcrumb-el>Components</q-breadcrumb-el>
2626
<q-breadcrumb-el>Breadcrumbs</q-breadcrumb-el>
2727
</q-breadcrumbs>
2828
<br><br>
2929
<q-breadcrumbs align="justify" style="max-width: 700px">
30-
<q-icon name="arrow_forward" slot="separator" />
30+
<q-icon name="arrow_forward" slot="separator" slot-scope="props" />
3131
<q-breadcrumb-el>Home</q-breadcrumb-el>
3232
<q-breadcrumb-el>Components</q-breadcrumb-el>
3333
<q-breadcrumb-el>Breadcrumbs</q-breadcrumb-el>

src/components/breadcrumbs/QBreadcrumbs.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,27 +27,28 @@ export default {
2727
}
2828
},
2929
computed: {
30-
computedAlign () {
31-
return alignMap[this.align]
30+
classes () {
31+
return [`text-${this.color}`, `justify-${alignMap[this.align]}`]
3232
}
3333
},
3434
render (h) {
3535
const
3636
child = [],
3737
length = this.$slots.default.length - 1,
38-
separator = this.$slots.separator
39-
? this.$slots.separator
40-
: this.separator,
38+
separator = this.$scopedSlots.separator || (() => this.separator),
4139
color = `text-${this.color}`,
4240
active = `text-${this.activeColor}`
4341

4442
this.$slots.default.forEach((comp, i) => {
4543
if (comp.componentOptions && comp.componentOptions.tag === 'q-breadcrumb-el') {
4644
const middle = i < length
4745

48-
child.push(h('div', { staticClass: `${middle ? active : color} ${middle ? 'text-weight-bold' : 'q-breadcrumb-last'}` }, [ comp ]))
46+
child.push(h('div', {
47+
'class': [ middle ? active : color, middle ? 'text-weight-bold' : 'q-breadcrumb-last' ]
48+
}, [ comp ]))
49+
4950
if (middle) {
50-
child.push(h('div', { staticClass: `q-breadcrumb-separator ${color}` }, [ separator ]))
51+
child.push(h('div', { staticClass: `q-breadcrumb-separator`, 'class': color }, [ separator() ]))
5152
}
5253
}
5354
else {
@@ -57,7 +58,7 @@ export default {
5758

5859
return h('div', {
5960
staticClass: 'q-breadcrumbs flex gutter-xs items-center overflow-hidden',
60-
'class': [`text-${this.color}`, `justify-${this.computedAlign}`]
61+
'class': this.classes
6162
}, child)
6263
}
6364
}

0 commit comments

Comments
 (0)