I have defined the following on my HTML:
<span v-if="valido" class="fas fa-check" style="position: absolute; right: 44px; top: 43px; color: green"></span>
<span v-else class="fas fa-exclamation-circle" style="position: absolute; right: 44px; top: 43px; color: red"></span>
Then I have this in my VM
data: {
valido: false
}
And this function is being called when a input changes value
validarRestricciones: function () {
var empid = this.inputValue.substring(this.inputValue.indexOf('(') + 1, this.inputValue.length - 1);
$.ajax({
type: 'get',
url: '/api/personas/validar?empid=' + empid,
contentType: 'application/json; charset=utf-8',
dataType: "json",
statusCode: {
200: function (data) {
this.valido = true;
return true;
},
412: function (data) {
this.valido = false;
return false;
},
500: function (data) {
return false;
}
}
});
}
Everything works fine and I can see in the console that valido
changes from false
to true
but it does not change or redraw the spans that are attached to valido
property. It seems that it is only done on the creation of the Vue component. How can I redraw that??.