找半天沒看到,結果 Google 看到 Github issue 也有人在討論 XD
<b-table bordered striped hover
:items="environments"
:fields="fields"
:current-page="currentPage"
:per-page="perPage"
:filter="filter"
v-model="shownItems"
@row-clicked="myRowClickHandler"
>
<template slot="actions" scope="environment">
<b-btn size="sm" @click="log(environment.item)">Details</b-btn>
</template>
</b-table>
methods: {
myRowClickHandler(record, index) {
// 'record' will be the row data from items
// `index` will be the visible row number (available in the v-model 'shownItems')
log(record); // This will be the item data for the row
}
}
https://github.com/bootstrap-vue/bootstrap-vue/issues/774
https://bootstrap-vue.js.org/docs/components/table#component-reference
沒有留言:
張貼留言