Skip to content

Commit 69aaab2

Browse files
mosinvepi0
authored andcommitted
fix(Table) update documentation
1 parent 63d8097 commit 69aaab2

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

src/components/table/README.md

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ Custom rendering for each data field in a row is possible using either
560560
or formatter callback function.
561561

562562
### Scoped Field Slots
563-
Scoped slots give you greater control over how the record data apepars.
563+
Scoped slots give you greater control over how the record data appears.
564564
If you want to add an extra field which does not exist in the records,
565565
just add it to the `fields` array, And then reference the field(s) in the scoped
566566
slot(s).
@@ -634,7 +634,7 @@ number will align with the indexes from the optional `v-model` bound variable._
634634
>- _When placing inputs, buttons, selects or links within a data cell scoped slot,
635635
be sure to add a `@click.stop` (or `@click.native.stop` if needed) handler (which can
636636
be empty) to prevent the click on the input, button, select, or link, from triggering
637-
the `row-clicked` event:_
637+
the `row-clicked` event:_
638638

639639
```html
640640
<template slot="actions" slot-scope="cell">
@@ -643,6 +643,35 @@ the `row-clicked` event:_
643643
</template>
644644
```
645645

646+
#### Displaying raw HTML
647+
By default `b-table` escapes HTML tags in items, if you need to display raw HTML code in `b-table`, you should use
648+
`v-html` prop in scoped field slot
649+
650+
```html
651+
<template>
652+
<b-table :items="items">
653+
<span slot="html" slot-scope="data" v-html="data.value">
654+
</span>
655+
</b-table>
656+
</template>
657+
658+
<script>
659+
export default {
660+
data () {
661+
return {
662+
items: [
663+
{
664+
text: 'This is <i>escaped</i> content',
665+
html: 'This is <i>raw <strong>HTML</strong></i> <span style="color:red">content</span>'
666+
}
667+
]
668+
}
669+
}
670+
}
671+
</script>
672+
673+
<!-- table-html-data-slots.vue -->
674+
```
646675

647676
### Formatter callback
648677
One more option to customize field output is to use formatter callback function.

0 commit comments

Comments
 (0)