我正在使用与 3 个滑块同步的 react-slick 滑块。使用 2 个滑块可以正常工作,但是当我尝试使用 3 个带有 2 个参考的滑块时,它不起作用。
constructor(props) {
super(props);
this.state = {
nav1: null,
nav2: null,
nav3: null,
};
}
componentDidMount() {
this.setState({
nav1: this.slider1,
nav2: this.slider2,
nav3: this.slider3,
});
}
<Slider
className="background-slider"
asNavFor={this.state.nav2, this.state.nav3}
ref={slider => (this.slider1 = slider)}
{...settings1}> ...
</Slider>
<Slider
className="content-slider"
asNavFor={this.state.nav1, this.state.nav3}
ref={slider => (this.slider2 = slider)}
{...settings2}> ...
</Slider>
<Slider
className="person-slider"
asNavFor={this.state.nav2, this.state.nav1}
ref={slider => (this.slider3 = slider)}
{...settings3}> ...
</Slider>
谢谢