Answer the question
In order to leave comments, you need to log in
Is it possible to painlessly change an observable property in an observer?
Good day, I ran into a problem that I could not solve myself.
There is an array watcher:
this.$watch(
'order.items',
() => {
this.getCalculation();
},
{
deep: true
}
);
items: [
{
id: 123,
price: 213,
discount: 123,
quantity: 1
},
{ ... }
]
// http.get('...')
order.items.map(item => {
const itemCalc = orderCalc.items.find(
itemCalc => itemCalc.productId === item.productId
);
item.price = itemCalc.price;
item.discount = itemCalc.priceDiscount;
});
commit('setOrder', order);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question