日本综合一区二区|亚洲中文天堂综合|日韩欧美自拍一区|男女精品天堂一区|欧美自拍第6页亚洲成人精品一区|亚洲黄色天堂一区二区成人|超碰91偷拍第一页|日韩av夜夜嗨中文字幕|久久蜜综合视频官网|精美人妻一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
創(chuàng)新互聯(lián)百度小程序教程:swiper 滑塊視圖容器
  • swiper 滑塊視圖容器
    • 屬性說明
      • change 事件 source 返回值
    • 示例
      • 代碼示例 1:
      • 代碼示例 2:自定義底部切換圓點
      • 代碼示例 3:模擬 tabs 組件功能
    • Bug & Tip
    • 常見問題
      • Q:swiper 的面板指示點能自定義樣式嗎?

    swiper 滑塊視圖容器

    解釋:滑塊視圖容器。內(nèi)部只允許使用 swiper-item 組件描述滑塊內(nèi)容,否則會導(dǎo)致未定義的行為。

    創(chuàng)新互聯(lián)公司從2013年開始,先為上蔡等服務(wù)建站,上蔡等地企業(yè),進行企業(yè)商務(wù)咨詢服務(wù)。為上蔡企業(yè)網(wǎng)站制作PC+手機+微官網(wǎng)三網(wǎng)同步一站式服務(wù)解決您的所有建站問題。

    屬性說明

    indicator-dots

    Boolean

    false

    是否顯示面板指示點

    indicator-color

    Color

    rgba(0, 0, 0, .3)

    指示點顏色

    indicator-active-color

    Color

    #333

    當(dāng)前選中的指示點顏色

    autoplay

    Boolean

    false

    是否自動切換

    current

    Number

    0

    當(dāng)前所在頁面的 index

    current-item-id

    String

    當(dāng)前所在滑塊的 item-id ,不能與 current 被同時指定

    1.11
    低版本請做兼容性處理

    interval

    Number

    5000

    自動切換時間間隔(單位:ms)

    duration

    Number

    500

    滑動動畫時長(單位:ms)

    circular

    Boolean

    false

    是否采用銜接滑動

    vertical

    Boolean

    false

    滑動方向是否為縱向

    previous-margin

    String

    “0px”

    前邊距,可用于露出前一項的一小部分,支持 px 和 rpx

    1.11
    低版本請做兼容性處理

    next-margin

    String

    “0px”

    后邊距,可用于露出后一項的一小部分,支持 px 和 rpx

    1.11
    低版本請做兼容性處理

    display-multiple-items

    Number

    1

    同時顯示的滑塊數(shù)量

    1.11
    低版本請做兼容性處理

    bindchange

    EventHandle

    current 改變時會觸發(fā) change 事件,event.detail = {current: current, source: source}

    bindanimationfinish

    EventHandle

    動畫結(jié)束時會觸發(fā) animationfinish 事件,event.detail 同上

    1.11
    低版本請做兼容性處理

    屬性名類型默認(rèn)值必填說明最低版本
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    change 事件 source 返回值

    change 事件中的 source 字段,表示觸發(fā) change 事件的原因,可能值如下:

    autoplay

    自動播放導(dǎo)致的 swiper 切換

    touch

    用戶滑動導(dǎo)致的 swiper 切換

    “”

    其他原因?qū)⒎祷乜兆址?/p>

    說明

    示例

    跳轉(zhuǎn)編輯工具

    在開發(fā)者工具中打開

    在 WEB IDE 中打開

    掃碼體驗

    代碼示例

    請使用百度APP掃碼

    代碼示例 1:

    • SWAN
    • JS
    • CSS
     
     
     
    1. class="swiper"
    2. indicator-dots="{{switchIndicateStatus}}"
    3. indicator-color="rgba(0,0,0,0.30)"
    4. indicator-active-color="#fff"
    5. autoplay="{{switchAutoPlayStatus}}"
    6. current="0"
    7. current-item-id="0"
    8. interval="{{autoPlayInterval}}"
    9. duration="{{switchDuration}}"
    10. circular="true"
    11. vertical="{{switchVerticalStatus}}"
    12. previous-margin="0px"
    13. next-margin="0px"
    14. display-multiple-items="1"
    15. bind:change="swiperChange"
    16. bind:animationfinish="animationfinish">
    17. s-for="item in swiperList"
    18. item-id="{{itemId}}"
    19. class="{{item.className}}">
    20. {{item.value}}
    21. 指示點
    22. class="init-switch"
    23. checked="{{switchIndicateStatus}}"
    24. bind:change="switchIndicate">
    25. 自動切換
    26. checked="{{switchAutoPlayStatus}}"
    27. bind:change="switchAutoPlay"
    28. class="init-switch">
    29. 縱向滑動
    30. checked="{{switchVerticalStatus}}"
    31. bind:change="switchVertical"
    32. class="init-switch">
    33. 滑塊切換時長
    34. {{switchDuration}}ms
    35. class="slider"
    36. min="300"
    37. max="1500"
    38. value="{{switchDuration}}"
    39. bind:change="changeSwitchDuration">
    40. 自動切換時間間隔
    41. {{autoPlayInterval}}ms
    42. class="slider"
    43. min="1000"
    44. max="5000"
    45. value="{{autoPlayInterval}}"
    46. bind:change="changeAutoPlayInterval">

    設(shè)計指南

    建議滑塊視圖數(shù)量控制在 2-5 個。
    建議滑塊切換時長不低于 500ms ,自動切換時間間隔不高于 5000ms 。

    代碼示例 2:自定義底部切換圓點

    • SWAN
    • JS
    • CSS
     
     
     
    1. 自定義底部切換圓點
    2. class="swiper-custom"
    3. autoplay="auto"
    4. interval="3000"
    5. duration="500"
    6. current="{{swiperCurrent}}"
    7. bindchange="swiperChangeCustom">

    代碼示例 3:模擬 tabs 組件功能

    • SWAN
    • JS
    • CSS
     
     
     
    1. 模擬 tabs 組件功能
    2. 全部
    3. 服務(wù)通知
    4. 系統(tǒng)通知
    5. 評論
    6. 其他
    7. 我是全部
    8. 我是服務(wù)通知
    9. 我是系統(tǒng)通知
    10. 我是評論
    11. 我是其他

    Bug & Tip

    • Tip:如果在 bindchange 的事件回調(diào)函數(shù)中使用 setData 改變 current 值,則會導(dǎo)致 setData 被重復(fù)調(diào)用,因而通常情況下請在改變 current 值前檢測 source 字段來判斷是否是由于用戶觸摸引起的。
    • Tip:組件內(nèi)部只可放置 swiper-item 組件,否則會導(dǎo)致未定義的行為。

    常見問題

    Q:swiper 的面板指示點能自定義樣式嗎?

    A:參見屬性說明,可以去掉 dot 顯示之后,自己定義 dot 樣式。具體代碼可參見上方代碼示例 2 。


    本文名稱:創(chuàng)新互聯(lián)百度小程序教程:swiper 滑塊視圖容器
    網(wǎng)頁URL:http://www.dlmjj.cn/article/cocsigo.html