Skip to content
Permalink
Browse files

fix(b-table, b-table-lite): handle edge case where field slot returns…

… no vNodes (fixes #3919) (#3920)
  • Loading branch information...
tmorehouse committed Aug 20, 2019
1 parent 611a507 commit a39205940f6ccf777e92c54d680e9ed0008abd77
Showing with 17 additions and 13 deletions.
  1. +3 −1 src/components/table/helpers/mixin-tbody-row.js
  2. +14 −12 src/components/table/helpers/mixin-thead.js
@@ -204,7 +204,9 @@ export default {
// a square bracket and if using in-document HTML templates, the
// v-slot attributes are lower-cased by the browser.
const slotNames = [`cell[${key}]`, `cell[${key.toLowerCase()}]`, 'cell[]']
let $childNodes = this.normalizeSlot(slotNames, slotScope) || toString(formatted)
let $childNodes = this.hasNormalizedSlot(slotNames)
? this.normalizeSlot(slotNames, slotScope)
: toString(formatted)
if (this.isStacked) {
// We wrap in a DIV to ensure rendered as a single cell when visually stacked!
$childNodes = [h('div', {}, [$childNodes])]
@@ -116,20 +116,22 @@ export default {
...slotNames
]
}
const slot = this.normalizeSlot(slotNames, {
label: field.label,
column: field.key,
field,
isFoot,
// Add in row select methods
selectAllRows,
clearSelected
})
if (!slot) {
// need to check if this will work
const hasSlot = this.hasNormalizedSlot(slotNames)
let slot = field.label
if (hasSlot) {
slot = this.normalizeSlot(slotNames, {
label: field.label,
column: field.key,
field,
isFoot,
// Add in row select methods
selectAllRows,
clearSelected
})
} else {
data.domProps = htmlOrText(field.labelHtml)
}
return h(BTh, data, slot || field.label)
return h(BTh, data, slot)
}

// Generate the array of <th> cells

0 comments on commit a392059

Please sign in to comment.
You can’t perform that action at this time.