将图片放入public中 可以新建文件夹
import React, { useRef } from 'react'
import { Swiper } from 'antd-mobile'
const bannerList = [
'/image/1.jpg',
'/image/2.jpg',
'/image/3.jpg',
'/image/4.jpg',
];
//const bannerList = [
//'https://zos.alipayobjects.com/rmsportal/AiyWuByWklrrUDlFignR.png',
//'https://zos.alipayobjects.com/rmsportal/TekJlZRVCjLFexlOCuWn.png',
//'https://zos.alipayobjects.com/rmsportal/IJOtIlfsYdTyaDTRVrLI.png',
//];
const items = bannerList.map((item, index) => (
<Swiper.Item key={index}>
<img
src={item}
alt=''
/>
</Swiper.Item>
))
export default () => {
return (
<Swiper
loop
autoplay
>
{items}
</Swiper>
)
}