• swiper高度自适应


    swiper这个问题一直困扰了我好久,一开始我是以分页的页数来写高度的,但是数据不够的话就会留白,显然是不好的用户体验,然后百度了很多种,选了一种最适合的,把循环的数据用view框起来,然后得到view的高,设置高度,就ok啦

    height: function () {
        var query = wx.createSelectorQuery()
        let _this = this
        query.select('.getHeight').boundingClientRect()
        query.exec(function (res) {
          _this.setData({
            height: res[0].height
          })
        })
      },

    页面:

     
         <view class="page" style="height: {{height}}px;">
    <!-- 列表 --> <view class="getHeight" hover-class="none" hover-stop-propagation="false"> <block wx:for="{{news}}" wx:key='item' data-index="{{index}}" wx:for-item="item"> <view>{{item.title}}</view> </block> </view>
         </view>
  • 相关阅读:
    如何在三维坐标中选择点
    java slider
    java combobox 多选框
    java BorderFrame.java
    java radioButton
    java checkbox
    java 文本窗口
    constexpr
    测试框架
    java 计算器
  • 原文地址:https://www.cnblogs.com/guomouren/p/13203575.html
Copyright © 2020-2023  润新知