首页  >  文章  >  微信小程序  >  小程序如何在轮播图里面实现点击跳转

小程序如何在轮播图里面实现点击跳转

angryTom
angryTom原创
2020-03-25 11:37:137395浏览

小程序如何在轮播图里面实现点击跳转

小程序如何在轮播图里面实现点击跳转

轮播图可以使用swiper组件来实现,点击跳转页面可以使用navigator组件来实现,所以实现点击轮播图跳转页面的方法是:在swiper组件的swiper-item组件里嵌套一个navigator即可。

具体实现代码如下:

1、WXML代码

  
  
    
      
        
          
         
      
    
  

2、WXSS代码

/* 轮播 */
.swiperBanner{
  width:100%;
  height:420rpx !important;
  margin:0 auto; 
}
.swiperBanner image{
  width:100%;
  height:420rpx !important;
}
swiper {
  width:100%;
  height:420rpx !important;
}

3、JS代码

indicatorDots:false,
   autoplay:true,
   interval:3000,
   duration: 800,
   circular:true,
    // 轮播图
   imgUrls: [
     {
       link:'../activity/washCar1/index/index',
       url:'https://localhost/static/ttcf/img/banner8.png',
 
     },
     {
       link: '../activity/Odysseus/index/index',
       url: 'https://localhost/static/ttcf/img/banner9.png',
 
     },
 
   ],

PHP中文网,大量免费小程序开发教程,欢迎学习!

以上是小程序如何在轮播图里面实现点击跳转的详细内容。更多信息请关注PHP中文网其他相关文章!

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn