SwiperPanel轮播面板

    引入

    在app.json或index.json中引入组件,默认为ES6版本

    1. "usingComponents": {
    2. "vtu-swiperPanel": "/miniprogram_npm/vtuweapp/swiperPanel/swiper/vtu-swiperPanel",
    3. "vtu-swiperPanel-item": "/miniprogram_npm/vtuweapp/swiperPanel/item/vtu-swiperPanel-item"
    4. }

    代码演示

    基础用法

    1. <vtu-tabs current="{{current}}" bind:change="change">
    2. <vtu-tab label="标签一" name="name1" badge="hot"></vtu-tab>
    3. <vtu-tab label="标签二" name="name2" badge="12"></vtu-tab>
    4. <vtu-tab label="标签三" name="name3"></vtu-tab>
    5. <vtu-tab label="标签四" name="name4"></vtu-tab>
    6. </vtu-tabs>
    7. <vtu-swiperPanel height="400px" current="{{current}}" bind:change="change">
    8. <vtu-swiperPanel-item name="name1" bindscrolltoupper="bindscrolltoupper" bindscrolltolower="bindscrolltolower"></vtu-swiperPanel-item>
    9. <vtu-swiperPanel-item name="name2"></vtu-swiperPanel-item>
    10. <vtu-swiperPanel-item name="name3"></vtu-swiperPanel-item>
    11. <vtu-swiperPanel-item name="name4" bindscrolltoupper="bindscrolltoupper" bindscrolltolower="bindscrolltolower"></vtu-swiperPanel-item>
    12. <view class="swiper" slot="name1">
    13. <view class="swiper_li" wx:for="{{20}}">区域一内容展示{{index}}</view>
    14. </view>
    15. <view class="swiper" slot="name2">
    16. <view class="swiper_li" wx:for="{{10}}">区域二内容展示{{index}}</view>
    17. </view>
    18. <view class="swiper" slot="name3">
    19. <view class="swiper_li" wx:for="{{15}}">区域三内容展示{{index}}</view>
    20. </view>
    21. <view class="swiper" slot="name4">
    22. <view class="swiper_li" wx:for="{{30}}">区域四内容展示{{index}}</view>
    23. </view>
    24. </vtu-swiperPanel>
    25. Page({
    26. data: {
    27. current: 3
    28. },
    29. change: function(e) {
    30. this.setData({
    31. current: e.detail.current
    32. })
    33. },
    34. bindscrolltoupper: function(e) {
    35. let param = e.detail
    36. wx.showToast({
    37. title: "Tab{0}滚动到顶部!".format(param.index+1),
    38. icon: 'none',
    39. duration: 2000
    40. });
    41. },
    42. bindscrolltolower: function(e) {
    43. let param = e.detail
    44. wx.showToast({
    45. title: "Tab{0}滚动到底部!".format(param.index+1),
    46. icon: 'none',
    47. duration: 2000
    48. });
    49. }
    50. });
    51.  

    组件参数

    SwiperPanel 轮播面板 - 图1