2018年5月18日 星期五

Bootstrap-Vue Table 綁定 row click 方法

藏在 document 的 Event 裡面...
找半天沒看到,結果 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

沒有留言:

張貼留言

如何在 golang 裡面引用 gitlab private repo

參考文章:https://stackoverflow.com/questions/27500861/whats-the-proper-way-to-go-get-a-private-repository 原文是用 gitlab.company.com 當範例,這邊改成一般帳號...