WeChat Open Platform

Mini Programs Documentation


Sliding view container

Attribute name Type Default value Description Minimum version
indicator-dots Boolean false Whether panel indicator dots displayed
indicator-color Color rgba(0, 0, 0, .3) Color of indicator dots {%version('1.1.0')%}
indicator-active-color Color #000000 Color of currently selected indicator dot {%version('1.1.0')%}
autoplay Boolean false Whether to switch automatically
current Number 0 Current page index
interval Number 5000 Automatic switching time interval
duration Number 500 Slide animation duration
circular Boolean false Whether to use cohesive sliding
bindchange EventHandle A change event will be triggered when current changes, event.detail = {current: current}  

Note: Only <swiper-item/> components can be placed in this component, otherwise this will lead to an undefined action.


Can only be placed in the <swiper/> component, height and width are automatically set at 100%.

Sample code:

<swiper indicator-dots="{{indicatorDots}}"
  autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}">
  <block wx:for="{{imgUrls}}">
      <image src="{{item}}" class="slide-image" width="355" height="150"/>
<button bindtap="changeIndicatorDots"> indicator-dots </button>
<button bindtap="changeAutoplay"> autoplay </button>
<slider bindchange="intervalChange" show-value min="500" max="2000"/> interval
<slider bindchange="durationChange" show-value min="1000" max="10000"/> duration
  data: {
    imgUrls: [
    indicatorDots: false,
    autoplay: false,
    interval: 5000,
    duration: 1000
  changeIndicatorDots: function(e) {
      indicatorDots: !this.data.indicatorDots
  changeAutoplay: function(e) {
      autoplay: !this.data.autoplay
  intervalChange: function(e) {
      interval: e.detail.value
  durationChange: function(e) {
      duration: e.detail.value