response.data.galleries.forEach(n => n.checkVideo = !!n.video);
this.forms = response.data.galleries;
n => n.checkVideo = !!n.video
эта короткая запись if true/false? data: function(){
return {
forms:[]
}
},
mounted(){
let element = {
title: '',
description: '',
image: '',
video: '',
xtype: 1,
checkVideo: false,
};
this.forms.push(element);
this.getArticle();
},
getArticle(){
const that = this;
axios.post('/cabinet/edit/post', {id:this.id})
.then((response) => {
console.log(response.data.tags);
this.artilcle.title = response.data.article.title;
this.artilcle.description = response.data.article.description;
this.is_numeric = response.data.article.is_numeric;
this.forms = response.data.galleries;
$(this.forms).each(function (index,value) {
if (value.video){
value.checkVideo = true;
}else{
value.checkVideo = false;
}
});
if (response.data.article.source != null && response.data.article.source != '') {
this.sourceRadio = 1;
this.sourceArticle = response.data.article.source;
}
let tg = response.data.tags;
$(tg).each(function(index,value ) {
that.tagsselect.push(value.tag_id);
});
})
.catch(error => {})
.finally(()=>{
that.findDisabledTab();
});
},