'how to set id from list data vue js to new component with props?
I want to set id from data table to another component, to provides I can edit data from table with edit table components ?
Here is my code :
<v-data-table
:headers="headers"
:items="listitem"
:items-per-page="5"
:search="search"
class="elevation-1"
>
<template v-slot:item="row">
<tr>
<td><v-btn color="primary" text>{{row.item.id}}</v-btn></td>
<td>{{row.item.application}}</td>
<td>{{row.item.title}}</td>
<td v-if="row.item.ticket_status === 'In Progress'"><v-btn color="warning" rounded x-small outlined >{{row.item.ticket_status}} </v-btn></td>
<td v-else-if="row.item.ticket_status === 'Open'"><v-btn color="success" rounded x-small outlined >{{row.item.ticket_status}} </v-btn></td>
<td v-else-if="row.item.ticket_status === 'Pending'"><v-btn color="error" rounded x-small outlined >{{row.item.ticket_status}} </v-btn></td>
<td v-else><v-btn color="primary" rounded x-small outlined >{{row.item.ticket_status}} </v-btn></td>
<td>{{row.item.reported_by}}</td>
<td>{{row.item.assign_to_username}}</td>
<td>{{row.item.submission_date}}</td>
<td>{{row.item.due_date}}</td>
<td>{{row.item.finish_date}}</td>
<td>
<EditTicket :to="{params:{id:row.item.id}}"> </EditTicket>
<v-btn x-small type="submit" mdi-delete color="error" @click="onDelete(row.item.id)">
<v-icon small dark>mdi-delete</v-icon>
</v-btn>
</td>
</tr>
</template>
</v-data-table>
and here my components edit table logic :
mounted : async function(){
**axios.get('https://localhost:44396/api/Ticket/')**
.then(response=>{
this.listitem.application = response.data.application;
this.listitem.ticket_category = response.data.ticket_category;
this.listitem.title = response.data.title;
this.listitem.problem_description = response.data.problem_description;
this.listitem.ticket_source = response.data.ticket_source;
this.listitem.ticket_status = response.data.ticket_status;
this.listitem.submission_date = response.data.submission_date;
this.listitem.due_date = response.data.due_date;
this.listitem.finish_date = response.data.finish_date;
this.listitem.assign_to_username = response.data.assign_to_username;
this.listitem.attachment = response.data.attachment;
this.listitem.reported_by = response.data.reported_by;
this.listitem.remarks = response.data.remarks;
console.log(response);
})
.catch(error=>{
console.log(error);
})
},
I can get the data but can't get as equal with the id
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

