1.引入 swiper版本5
2.vue-awesome-swiper版本4
注意:它俩的版本要对应,引入其他版本可能会出错
<swiper
style="width: 400px; border: 1px solid #ccc"
ref="mySwiper"
:options="swiperOption"
>
<swiper-slide
class="recommend-item"
v-for="item of recommends"
:key="item.goodsId"
>
<div class="name">{{ item.goodsName }}</div>
</swiper-slide>
</swiper>
<script>
import { Swiper, SwiperSlide } from "vue-awesome-swiper";
export default {
components: {
Swiper,
SwiperSlide,
},
}
</script>