Answer the question
In order to leave comments, you need to log in
Why does v-on:click work every other time?
I made a small application on vue.js, el.whata.ninja
The point
is that each product has combinations of this product, started implementation, and encountered a bug/feature
If you add a line (1), then add a combination (2), to it attribute (3)
Then if you click on the attributes of the combination (4) and the combinations themselves, they are clicked, but somehow through time,
I can’t understand what could be the matter.
The method that is executed when the attribute is added:
putAttribute(combination, name){
console.clear();
console.log(combination, name);
if(name == ""){
return false;
}
let combination_index = _.findIndex(this.combinations, function(o) {
return o.id == combination;
});
let hasValue = _.findIndex(this.combinations[combination_index].attributes, function(o) {
return o.name == name;
}) >= 0;
console.log(combination_index, hasValue);
if(hasValue){
return false;
}else{
let new_attribute = {
name: name,
value: 'иний'
};
this.combinations[combination_index].attributes.push(new_attribute);
}
}
allAtributes(){
let allAtributes = [];
_.each(this.combinations, function(combination){
_.each(combination.attributes, function(attribute){
allAtributes.push(attribute.name);
});
});
return _.uniq(allAtributes);
}
<!--Attributes--> <!--/Attributes-->
Answer the question
In order to leave comments, you need to log in
In my opinion, it's banal that the click only works when you hit the cross for sure.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question