Answer the question
In order to leave comments, you need to log in
How to get rid of reactivity?
I have a component with tickets, I want to get rid of reactivity. Let me explain.
There is a table:
<tr v-for="(oneTicket, index) in allTickets">
<td>{{index + 1}}</td>
<td>{{oneTicket.title}}</td>
<td>{{oneTicket.price}}</td>
<td>{{oneTicket.quantity}}</td>
<td>{{oneTicket.description}}</td>
</tr>
ticket:{
title: null,
price: 0,
quantity: 0,
description: null
},
allTickets: []
methods: {
addTicket(){
let ticket = this.ticket; //пытался избавиться от реактивности
this.allTickets.push(ticket);
},
<input v-model="ticket.title">
<input v-model="ticket.price">
<input v-model="ticket.quantity">
<textarea v-model="ticket.description">
<button @click="addTicket"
Answer the question
In order to leave comments, you need to log in
This is how you need to get rid of:
I.e. create a new object instead of assigning a reference to the object.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question