>  기사  >  위챗 애플릿  >  캐러셀 차트의 미니 프로그램에서 클릭 점프를 구현하는 방법

캐러셀 차트의 미니 프로그램에서 클릭 점프를 구현하는 방법

angryTom
angryTom원래의
2020-03-25 11:37:137502검색

캐러셀 차트의 미니 프로그램에서 클릭 점프를 구현하는 방법

애플릿 내 캐러셀 차트에서 클릭 점프 구현 방법

캐러셀 차트는 swiper 컴포넌트를 이용하여, 클릭 점프 페이지는 navigator 컴포넌트를 이용하여 구현할 수 있으며, 따라서 회전식 차트를 클릭하여 페이지로 이동합니다. 방법은 다음과 같습니다. swiper 구성 요소의 swiper-item 구성 요소에 네비게이터를 중첩합니다.

구체적인 구현 코드는 다음과 같습니다:

1, WXML 코드

  <!--轮播图 -->
  <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>

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:&#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;,
 
     },
 
   ],

PHP 중국어 웹사이트, 다수의 무료 소규모 프로그램 개발 튜토리얼, 학습을 환영합니다!

위 내용은 캐러셀 차트의 미니 프로그램에서 클릭 점프를 구현하는 방법의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.