做的比较丑 最后图片
本来打算用vue-carousel-3d这个组件的,但是这个组件一直报源码错误,修改了半天也没有解决
使用了swiper组件 html部分代码
<div class="swiper-container swiper1" style="height: 650px;width: 1500px">
<div class="swiper-wrapper">
<div class="swiper-slide">
<div class="box-card">
<img src="../../assets/homeScroll/trunkRoad.png" alt="" />
<br>
<el-button type="primary" @click="jumpUrl1">国省干道</el-button>
</div>
</div>
<div class="swiper-slide">
<div class="box-card">
<img src="../../assets/homeScroll/bikeSystem.png" alt="" />
<br>
<el-button type="primary" @click="jumpUrl2">自行车系统</el-button>
</div>
</div>
<div class="swiper-slide">
<div class="box-card">
<img src="../../assets/homeScroll/bridge.png" alt="" />
<br>
<el-button type="primary">桥梁</el-button>
</div>
</div>
<div class="swiper-slide">
<div class="box-card">
<img src="../../assets/homeScroll/cityExpressway.png" alt="" />
<br>
<el-button type="primary">城市快速路</el-button>
</div>
</div>
<div class="swiper-slide">
<div class="box-card">
<img src="../../assets/homeScroll/resultIntegration.png" alt="" />
<br>
<el-button type="primary" @click="jumpUrl3">结果集成</el-button>
</div>
</div>
<div class="swiper-slide">
<div class="box-card">
<img src="../../assets/homeScroll/trunkRoad.png" alt="" />
<br>
<el-button type="primary">高速公路</el-button>
</div>
</div>
<div class="swiper-slide">
<div class="box-card">
<img src="../../assets/homeScroll/bikeSystem.png" alt="" />
<br>
<el-button type="primary" @click="jumpUrl2">自行车系统</el-button>
</div>
</div>
</div>
<div class="swiper-button-prev"></div>
<div class="swiper-button-next"></div>
</div>
<script>
import { onMounted } from "vue";
import Swiper, {
Autoplay,
EffectCoverflow,
EffectCube,
Pagination,
Navigation,
} from "swiper";
Swiper.use([Autoplay, EffectCoverflow, EffectCube, Pagination, Navigation]);
import "swiper/swiper-bundle.min.css";
import "swiper/swiper.min.css";
export default {
setup() {
onMounted(() => {
new Swiper(".swiper1", {
loop: true,
spaceBetween: 40,
effect: "coverflow",
grabCursor: true,
centeredSlides: true,
slidesPerView: 5,
pagination: {
el: ".swiper-pagination",
clickable: true,
},
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
},
coverflowEffect: {
rotate: 0,
stretch: 0,
depth: 100,
modifier: 1,
slideShadows: false,
}
});
});
},
methods:{
jumpUrl1(){
const routeData = this.$router.replace({
path: '/index',
});
}
}
}
</script>
|