当页面有左右滑动,并且下面的数据较长的时候,用swiper控制,会出现swiper-item的高度固定的情况。

解决办法:

1.<swiper style="height: {{clientHeight?clientHeight+'px':'auto'}}"> 

其中clickHeight的值为(获取屏幕高度)

wx.getSystemInfo({

success: function (res) {

that.setData({

clientHeight: res.windowHeight});}})

2.在swiper中套用一层<scroll>,代码如下:

<swiper-item>

<scroll-view scroll-y="true" style="height: auto">

<view class="context">

<template is="wxParse" data="{{wxParseData:article.nodes}}" />

</view>

</scroll-view>

</swiper-item>

这样里面的东西就可以自由放置了

Logo

开源鸿蒙跨平台开发社区汇聚开发者与厂商,共建“一次开发,多端部署”的开源生态,致力于降低跨端开发门槛,推动万物智联创新。

更多推荐