Answer the question
In order to leave comments, you need to log in
Bugs in vue.js?
Hello, I am using vuex to store data. In mutations added a method that fills an array with numbers. Before filling, I bring each value to the parseInt () number. But when I get this array, all the numbers in it are strings. Who faced?
The next bug is related to changing the data. In the same vuex there is an object where the keys are the product id and the value is the product itself. When adding a new product to the mutation, I do this state.products[product.id] = product;
. In the application code, these changes are not tracked.
//Не работает вот так
<span v-if="$store.state.products[id]"></span>
//И вот так
computed: {
productExists: function(id) {
return this.$store.state.products[id];
}
}
Answer the question
In order to leave comments, you need to log in
When adding a new product to a mutation, it is necessary to assign an updated array to the property or use overridden methods to preserve reactivity, they write about this in
the documentation
There are not thousands of products
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question