1
를 반응 나는 다음과 같은 개체 목록이 있습니다설정 시간 초과 기능
mediaList[
{id:1, url:"www.example.com/image1", adType:"image/jpeg"},
{id:2, url:"www.example.com/image2", adType:"image/jpg"},
{id:3, url:"www.example.com/video1", adType: "video/mp4"}
]
내가 구성 가능한 시간 (1 초, 5, 10 초)가 슬라이드 쇼를 만들 필요가 있습니다. 은 지금까지 나는 내가 지금하고 싶은 것은 미디어를 자동 재생을위한 구성 가능한 기간에 한 번에 하나씩 생성되는 mediaList
renderSlideshow(ad){
let adType =ad.adType;
if(type.includes("image")){
return(
<div className="imagePreview">
<img src={ad.url} />
</div>
);
}else if (adType.includes("video")){
return(
<video className="videoPreview" controls>
<source src={ad.url} type={adType}/>
Your browser does not support the video tag.
</video>
)
}
}
render(){
return(
<div>
{this.props.mediaList.map(this.renderSlideshow.bind(this))}
</div>
)
}
에서 미디어의 목록을 생성 할 수 있습니다.
은 내가이 예처럼의 setTimeout 기능의 일부 양식을 사용할 필요가 알고
setTimeout(function(){
this.setState({submitted:false});
}.bind(this),5000); // wait 5 seconds, then reset to false
내가이 시나리오를 구현하는 방법을 단지 모르겠어요. (나는 페이드 전환을 위해 CSS를 사용할 필요가 있다고 생각하지만, 처음에는 전환을 만드는 방법을 모르겠다.)
이것은 약간의 작은 업데이 트로 그것을 밖으로 테스트하고 그것은 작동합니다! 감사합니다 – lost9123193
아주 좋은 접근! 그것은 나를 도왔다! 고마워. – Aayushi