Created
November 10, 2019 19:18
-
-
Save cjaoude/e85291d5b1413d849a61c5a87b86f15d to your computer and use it in GitHub Desktop.
selectable + transitions bootstrap-vue table
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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