Home > WeChat Applet > Mini Program Development > How to implement click jump in mini program in carousel chart

How to implement click jump in mini program in carousel chart

angryTom
Release: 2020-03-25 11:37:13
Original
7622 people have browsed it

How to implement click jump in mini program in carousel chart

How the applet implements click-to-jump in the carousel chart

The carousel chart can be implemented using the swiper component. Click to jump to the page. This can be achieved using the navigator component, so the way to achieve clicking on the carousel chart to jump to the page is to nest a navigator in the swiper-item component of the swiper component.

The specific implementation code is as follows:

1, WXML code

  <!--轮播图 -->
  <view class=&#39;swiperBanner&#39;>
    <swiper indicator-dots=&#39;{{indicatorDots}}&#39; autoplay=&#39;{{autoplay}}&#39; interval=&#39;{{interval}}&#39; duration=&#39;{{duration}}&#39; circular=&#39;{{circular}}&#39;>
      <swiper-item  wx:for="{{imgUrls}}" wx:key=&#39;{{index}}&#39;>
        <navigator url=&#39;{{item.link}}&#39;>
          <image src="{{item.url}}" class="slide-image" mode="aspectFill"></image>
        </navigator> 
      </swiper-item>
    </swiper>
  </view>
</view>
Copy after login

2, WXSS code

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

3, JS code

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

PHP Chinese website, a large number of free small program development tutorials, welcome to learn!

The above is the detailed content of How to implement click jump in mini program in carousel chart. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template