在<ul>

时间:2018-07-24 07:09:25

标签: javascript reactjs react-slick

我想将React-slick slides的所有li包裹在ul中。我浏览了文档,发现slide属性可用于更改container元素。它的包装元素名称为string。默认值为div,我将其更改为ul,但仍将div作为容器div

class App extends Component {
  render() {
    let settings = {
      dots: true,
      infinite: true,
      speed: 500,
      slidesToShow: 1,
      slidesToScroll: 1,
      slide: "ul"
    };
    return (
      <Slider {...settings}>
        <li>
          <h3>1</h3>
        </li>
        <li>
          <h3>2</h3>
        </li>
        <li>
          <h3>3</h3>
        </li>
        <li>
          <h3>4</h3>
        </li>
        <li>
          <h3>5</h3>
        </li>
        <li>
          <h3>6</h3>
        </li>
      </Slider>
    );
  }
}

Codesandbox链接https://codesandbox.io/s/0xjlvkp9jl

0 个答案:

没有答案