Попробуйте использовать <template v-slot:item.actions="{ item }">
для доступа к текущему элементу (строке)
<v-data-table
dense
:headers="header"
:items="items"
class="elevation-1"
>
<template v-slot:item.actions="{ item}">
<v-btn @click="deleteRow(item )">delete</v-btn>
</template>
</v-data-table>
метод:
deleteRow(item:any){
let index=this.items.findIndex(it=>it.email===item.email)
this.items.splice(index,1);
}
заголовки:
header = [
{text:'name',value:'name'},
{text:'email',value:'email'},
,
{
text: 'Actions',
value: 'actions',
sortable: false
},
]
остальные поля отображаются автоматически
var app = new Vue({
el: '#app',
vuetify: new Vuetify(),
data: {
employees: [{
"id": "1",
"employee_name": "Tiger Nixon",
"employee_salary": "320800",
"employee_age": "61",
"profile_image": ""
},
{
"id": "2",
"employee_name": "Garrett Winters",
"employee_salary": "170750",
"employee_age": "63",
"profile_image": ""
},
{
"id": "3",
"employee_name": "Ashton Cox",
"employee_salary": "86000",
"employee_age": "66",
"profile_image": ""
},
{
"id": "4",
"employee_name": "Cedric Kelly",
"employee_salary": "433060",
"employee_age": "22",
"profile_image": ""
},
{
"id": "5",
"employee_name": "Airi Satou",
"employee_salary": "162700",
"employee_age": "33",
"profile_image": ""
},
{
"id": "6",
"employee_name": "Brielle Williamson",
"employee_salary": "372000",
"employee_age": "61",
"profile_image": ""
}
],
headers: [{
text: 'ID',
value: 'id'
},
{
text: 'employee name',
value: 'employee_name'
},
{
text: 'employee salary',
value: 'employee_salary'
},
{
text: 'employee age',
value: 'employee_age'
},
{
text: 'Actions',
value: 'actions',
sortable: false
},
]
},
methods: {
deleteRow(item) {
let index = this.employees.findIndex(emp => emp.id === item.id)
this.employees.splice(index, 1);
}
}
})
<link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/@mdi/font@5.x/css/materialdesignicons.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/vue@2.x/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.js"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<div id="app">
<v-app id="inspire">
<v-data-table :headers="headers" :items="employees" class="elevation-1">
<template v-slot:item.actions="{ item }">
<v-btn @click="deleteRow(item)">delete</v-btn>
</template>
</v-data-table>
</v-app>
</div>