Skip to content

Instantly share code, notes, and snippets.

@cjaoude
Created November 10, 2019 19:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cjaoude/e85291d5b1413d849a61c5a87b86f15d to your computer and use it in GitHub Desktop.
Save cjaoude/e85291d5b1413d849a61c5a87b86f15d to your computer and use it in GitHub Desktop.
selectable + transitions bootstrap-vue table
<template>
<div>
<b-table
id="table-transition-example"
:items="items"
:fields="fields"
striped
small
primary-key="a"
selectable
:select-mode="selectMode"
selected-variant="active"
@row-selected="onRowSelected"
:tbody-transition-props="transProps"
></b-table>
{{ selected }}
</div>
</template>
<script>
export default {
data() {
return {
transProps: {
// Transition name
name: 'flip-list'
},
items: [
{ a: 2, b: 'Two', c: 'Moose' },
{ a: 1, b: 'Three', c: 'Dog' },
{ a: 3, b: 'Four', c: 'Cat' },
{ a: 4, b: 'One', c: 'Mouse' }
],
fields: [
{ key: 'a', sortable: true },
{ key: 'b', sortable: true },
{ key: 'c', sortable: true }
],
selectMode: 'multi',
selected: []
}
},
methods: {
onRowSelected(items) {
this.selected = items
},
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment