Skip to content

Commit d8971a4

Browse files
author
Pooya Parsa
committed
misc(b-table): move .table-responsive to a wrapper element
twbs/bootstrap#25058
1 parent d1a1f2f commit d8971a4

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/components/table/table.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,8 @@ export default {
303303
rows
304304
)
305305

306-
// Return the assembled table
307-
return h(
306+
// Assemble table
307+
const table = h(
308308
'table',
309309
{
310310
class: t.tableClasses,
@@ -318,6 +318,9 @@ export default {
318318
},
319319
[ caption, colgroup, thead, tfoot, tbody ]
320320
)
321+
322+
// Add responsive wrapper if needed and return table
323+
return t.isResponsive ? h('div', { class: t.responsiveClass }, [ table ]) : table
321324
},
322325
data () {
323326
return {
@@ -593,6 +596,9 @@ export default {
593596
const responsive = this.responsive === '' ? true : this.responsive
594597
return this.isStacked ? false : responsive
595598
},
599+
responsiveClass () {
600+
return this.isResponsive === true ? 'table-responsive' : (this.isResponsive ? `table-responsive-${this.responsive}` : '')
601+
},
596602
tableClasses () {
597603
return [
598604
'table',
@@ -604,7 +610,6 @@ export default {
604610
this.small ? 'table-sm' : '',
605611
this.outlined ? 'border' : '',
606612
this.fixed ? 'b-table-fixed' : '',
607-
this.isResponsive === true ? 'table-responsive' : (this.isResponsive ? `table-responsive-${this.responsive}` : ''),
608613
this.isStacked === true ? 'b-table-stacked' : (this.isStacked ? `b-table-stacked-${this.stacked}` : '')
609614
]
610615
},

0 commit comments

Comments
 (0)