feat(TouristAttractionsAutoJs): Cria condição para aplicar o slick somente com o class do slick

This commit is contained in:
William Simão Cavalcante 2022-11-26 10:48:23 -03:00
parent 9e48537903
commit d9311cec6e

View File

@ -28,7 +28,7 @@ export class TouristAttractions {
this.events();
this.carrossel();
this.renderListItems();
this.removeSlick();
this.slickAdd();
}
selectors () {
@ -71,6 +71,25 @@ export class TouristAttractions {
}
};
addProperty (e) {
e.preventDefault();
const spotImg = this.spanInput.children[0].src
const spotTitle = e.target['input-title'].value
const spotDescription = e.target['input-description'].value
if (spotImg != '' && spotTitle != '' && spotDescription != '') {
const spot = {
image: spotImg,
titulo: spotTitle,
description: spotDescription,
};
this.list.push(spot);
this.renderListItems();
this.resetInputs();
}
};
renderListItems () {
let spotStructure = '';
@ -111,26 +130,14 @@ export class TouristAttractions {
}
};
addProperty (e) {
e.preventDefault();
const spotImg = this.spanInput.children[0].src
const spotTitle = e.target['input-title'].value
const spotDescription = e.target['input-description'].value
if (spotImg != '' && spotTitle != '' && spotDescription != '') {
const spot = {
image: spotImg,
titulo: spotTitle,
description: spotDescription,
};
this.list.push(spot);
this.renderListItems();
this.resetInputs();
slickAdd () {
const ulListSlick = this.ulList;
if (ulListSlick.classList.value === 'slick-initialized') {
this.carrossel();
}else {
this.removeSlick();
}
}
};
resetInputs () {
this.inputTitle.value = '';