new Vue({
el: '#twofamain',
data: {
twoFactory: false
},
beforeCreate: function() {
},
created: function () {
$.ajax({
url: "../php/getdashboard.php",
type: "POST",
data: {
emailLog:emailLog
},
success: function (res){
var obj = JSON.parse(res);
this.twoFactory = Boolean(Number(obj.twofactorturn));
console.log(this.twoFactory);
}
});
},
computed: {
tfa: function () {
if (this.twoFactory == true) {
return true;
}
else {
return false;
}
}
}
<div v-if="tfa">
<h1>Код 2fa</h1>
</div>