<el-carousel height="250px"> <el-carousel-item v-for="item in carouselList" :key="item"> <img :src="item.path" /> </el-carousel-item> </el-carousel>
const carouselList = reactive([ { path: require(‘../../static/img/1.jpg‘) }, { path: require(‘../../static/img/2.jpg‘) }, { path: require(‘../../static/img/3.jpg‘) } ])
使用图片时需要require引入,直接写图片路径不生效