I'm new to VueJS, I've got warning from Vue,
[Vue warn]: You may have an infinite update loop in a component render function.
When i use V-for variable in V-bind:style, here is an example :
in template :
<div v-for="item in model.items" v-bind:class="test(item.result)">
{{item.id}}
</div>
in script :
data() {
return {
accept: false,
not_accept: false,
};
},
methods: {
test(result) {
if (result == 'accept') {
this.accept = true;
this.not_accept = false;
} else if (result == 'Not accept') {
this.accept = false;
this.not_accept = true;
} else {
console.log(result);
}
return {
success: this.accept,
danger: this.not_accept,
};
},
},
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…