0.1.17 • Published 1 year ago

tiny-react-swiper v0.1.17

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

使用

安装

npm i tiny-react-swiper

引入 css

import 'tiny-react-swiper/dist/swiper.css'

引入组件

import Swiper from 'tiny-react-swiper'

const imageSrc = [
  '//p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/cd7a1aaea8e1c5e3d26fe2591e561798.png~tplv-uwbnlip3yd-webp.webp',
  '//p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/6480dbc69be1b5de95010289787d64f1.png~tplv-uwbnlip3yd-webp.webp',
  '//p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/0265a04fddbd77a19602a15d9d55d797.png~tplv-uwbnlip3yd-webp.webp',
  '//p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/24e0dd27418d2291b65db1b21aa62254.png~tplv-uwbnlip3yd-webp.webp',
];

export default function Demo() {
  const ref = useRef<SwiperRef>(null);

  return (
    <>
      <div
        style={{
          display: 'flex',
          justifyContent: 'space-around',
          margin: '10px',
        }}
      >
        <button onClick={() => ref.current?.moveToPrevious()}>Previous</button>
        <button onClick={() => ref.current?.moveTo(1)}>Slider-1</button>
        <button onClick={() => ref.current?.moveTo(2)}>Slider-2</button>
        <button onClick={() => ref.current?.moveToNext()}>Next</button>
      </div>

      <Swiper ref={ref}>
        {imageSrc.map(img => {
          return (
            <img
              key={img}
              className="w-full"
              height={196}
              width={349}
              alt="introduce_1"
              loading="eager"
              src={img}
            />
          );
        })}
      </Swiper>
    </>
  );
}
0.1.20

1 year ago

0.1.10

2 years ago

0.1.11

2 years ago

0.1.12

2 years ago

0.1.13

2 years ago

0.1.15

1 year ago

0.1.16

1 year ago

0.1.8

2 years ago

0.1.17

1 year ago

0.1.7

2 years ago

0.1.18

1 year ago

0.1.19

1 year ago

0.1.9

2 years ago

0.1.4

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago