async
tabChange = (e) => {
const isWebp = this.canUseWebp()
const size = window.innerWidth;
const childs = e.target.parentNode.childNodes;
childs.forEach( (k,i) =>{
k.removeAttribute("class");
k.setAttribute("index", i);
})
e.target.setAttribute("class", "active");
const index = Number(e.target.getAttribute("index"));
var data = this.state.brands[index];
data.map( (item,index) => (
item.source = isWebp ? `${item.source}?x-oss-process=image/resize,w_${size}/format,webp`:item.source
))
const _this = this;
async function FnData(){
_this.setState({
campaigns:[data]
});
}
FnData().then( result => {
const parent = document.querySelector(".swiper-container-campaign");
const imgs = parent.getElementsByTagName("img");
for (var i = 0; i< imgs.length; i++) {
imgs[i].setAttribute("src", imgs[i].getAttribute("data-src"));
}
})
}