S
S
sir_pounce2020-10-30 17:24:58
Vue.js
sir_pounce, 2020-10-30 17:24:58

The Vue component stopped updating, what's the problem?

The component is not updated. The problem is that in the application, on the Cart tab (filled from the cart storage module), the number of goods is not updated. But if elements are initially added to the module array, this property will be updated. What am I doing wrong?

link to sandbox - https://codesandbox.io/s/lively-voice-sf1vq?file=/...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2020-10-30
@sir_pounce

Someone inattentively read the documentation .
Replace with . Or, replaceproduct.amount = 1;Vue.set(product, 'amount', 1);

product.amount = 1;
state.items.push(product);

on the
state.items.push({
  ...product,
  amount: 1,
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question