Я борюсь с этой проблемой уже несколько дней. Я надеюсь, что кто-то может помочь
я вышел.
У меня есть карта оплаты, где я пытаюсь обновить количество и общую стоимость. :
родительский компонент :
<template>
<div>
<upsell-checkout-product
:product="product"
:index="index"
@remote="remove"
@increment="increment"
@decrement="decrement"
></upsell-checkout-product>
</div>
</template>
<script>
export default {
props: {
runId: {
type: String,
default: null
},
card: {
type: Array,
default: null
},
customer: {
type: Object,
default: null
},
order: {
type: Object,
default: null
}
},
data() {
return {
localCard: []
}
},
mounted() {
this.localCard = this.card;
},
methods: {
increment(index) {
Vue.set(this.localCard[index], 'quantity', this.localCard[index].quantity+=1);
},
decrement(index) {
if(this.localCard[index].quantity > 0) {
this.localCard[index].quantity--;
}
},
remove(index) {
this.localCard.splice(index, 1);
}
}
}
</script>
Дочерний компонент:
<template>
<div class="text-green">
<div class="flex center p-2">
<div class="w-1/3">
<img class="rounded-full h-24 w-24 border border-green"
:src="'/storage/articles/' + product.article.image_url"
v-if="product.article.image_url"
/>
</div>
<div class="w-2/3">
<h3>{{ product.article.name }}</h3>
<h5 class="mt-2">Bestaalstatus</h5>
<div>
<div class="bg-red text-white text-xs mt-2 rounded p-1 w-1/3">
Niet voldaan
</div>
</div>
</div>
</div>
<div class="center justify-between p-2 border-t border-b border-dotted border-green">
<div class="w-1/5">
<div class="cursor-pointer" @click="$emit('remove', index)">
x
</div>
</div>
<div class="center w-2/5">
<div class="cursor-pointer" @click="$emit('decrement', index)">
-
</div>
<input type="number"
class="input-main w-1/2 ml-1 mr-1 h-8"
v-model="product.quantity">
<div class="cursor-pointer" @click="$emit('increment', index)">
+
</div>
</div>
<div class="flex justify-end w-2/5">
<div v-if="product.article.member_discount_percentage">
<p class="text-sm">€ <strike>{{ price }}</strike> - € {{ discountPrice }}</p>
</div>
<div v-else>
<p class="text-sm">€ {{ discountPrice }}</p>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
props: ['product', 'index'],
computed: {
price: function() {
return (this.product.quantity * this.product.article.price).toFixed(2);
},
discountPrice: function() {
return (this.product.quantity * this.product.article.discount_price).toFixed(2);
}
}
}
</script>
Проблема в том, что элементы карты, которые я уже извлек с сервера, реагируют на локальную карту, но элементы, которые не были получены с сервера, но добавлены в процессе оформления покупки, не ...
Я уже пытался создать JsFiddle, но не могу воспроизвести проблему. Очевидно, что это проблема реактивности, но я понятия не имею, как мне это исправить.

Мне нужна помощь, спасибо!