Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(b-table, b-table-lite): handle edge case where field slot returns no vNodes (fixes #3919) #3920

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/components/table/helpers/mixin-tbody-row.js
Original file line number Diff line number Diff line change
Expand Up @@ -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])]
Expand Down
26 changes: 14 additions & 12 deletions src/components/table/helpers/mixin-thead.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down