我是nuka-carousel react的新手。我想添加上一张/下一张箭头按钮,而不仅仅是“上一个”和“下一个”按钮。我找到了各种解决方案,其中包括编写一个修饰函数。我尝试了它,但没有得到我期望的结果。以下是我的代码:
import Carousel from 'nuka-carousel';
import createReactClass from 'create-react-class';
var Decorators = [
{
component: createReactClass({
render() {
return (
<div>
<i className="fa fa-arrow-left" onClick={this.props.previousSlide} aria-hidden="true"></i>
</div>
)
}
}),
position: 'CenterLeft',
style: {
padding: 20
}
},
{
component: createReactClass({
render() {
return (
<div>
<i className="fa fa-arrow-right" onClick={this.props.nextSlide} aria-hidden="true"></i>
</div>
)
}
}),
position: 'CenterRight',
style: {
padding: 20
}
}
];
return(
<Carousel decortators={Decorators} slidesToShow={3} cellSpacing={50} >
{cards}
</Carousel>
);