Vue b-table change one column into link

Viewed 739

I am really new to vue and for this project I am using Vue, Bootstrap-vue to paginate my data teamList. Is there a way that I can change the teamList.first_name into the link so that I can use onSelect or onClick event once the user clicks on the first_name value.

Code on JsFiddle = https://jsfiddle.net/ujjumaki/aLdgo7xq/8/

VIEW

<div class="overflow-auto">
    <b-pagination v-model="currentPage" :total-rows="rows" :per-page="perPage" aria-controls="my-table"></b-pagination>
    <p class="mt-3">Current Page: {{ currentPage }}</p>
    <b-table id="my-table" :items="teamList" :per-page="perPage" :current-page="currentPage" medium selectable>
    </b-table>
</div>

JavaScript

data(){
  return{
    teamList: [
          { id: 5, first_name: 'Pebbles', last_name: 'Flintstone' },
          { id: 6, first_name: 'Bamm Bamm', last_name: 'Rubble' },
          { id: 7, first_name: 'The Great', last_name: 'Gazzoo' },
          { id: 8, first_name: 'Rockhead', last_name: 'Slate' },
          { id: 9, first_name: 'Pearl', last_name: 'Slaghoople' }
    ],
    perPage: 2,
    currentPage: 1
    }
},

Computed

computed: {
    rows() {
       return this.teamList.length
    }
},
1 Answers
<b-table id="my-table" :items="teamList" :per-page="perPage" :current-page="currentPage" medium>
  <template #cell(first_name)="data">
    <a href="#" @click="functionName">{{data.value}}</a>
  </template>
</b-table>
Related