小程序滚动条位置设置及获取

为你画地为牢 发布于 2018/10/25 09:43
阅读 72
收藏 0

微信小程序中,从首页跳转到详情页后,再返回首页时,怎样将滚动条位置显示在先前的位置,而不是直接置顶,有什么办法?代码如下:

<view class="groups-list">

<view class="list">

<view wx:for="{{products}}" wx:for-item="product" wx:key>

<view class="groups-item" catchtap="toDetail" id="{{product.id}}">

<image src="{{product.image}}" class="groups-image" mode="widthFix"></image>

<view class="text">

<view class="left">

<view class="name">

<text class="ch">{{product.name}}</text>

<text class="en">{{product.viceName}}</text>

</view>

<view class="price-sold">

<view wx:if="{{userInfo.userType==2}}">

<text class="price"><text>¥</text>{{product.price}}</text>

</view>

<view wx:else style="display: flex;justify-content: space-between;">

<text class="price"><text>aaaa{{product.marketPrice}}</text></text>

<text class="huopinj" catchtap='toAuth'>bbbb</text>

</view>

<text class="sold">cccc {{product.pingNum}}{{product.standard}}</text>

</view>

<view class="progress-wrapper">

<progress percent="{{product.pingNum/product.overNum*100}}" stroke-width="20" class="progress" backgroundColor="#fbbfbf" activeColor="#e60012" active />

<text class="prog-text" space="emsp">{{product.overNum}}{{product.standard}}dddd{{product.overNum-product.pingNum}}</text>

</view>

</view>

<!--left -->

 

<view class="right">

<view wx:if="{{product.status==1}}">

<view class="title">fffff</view>

<view class="time">

<text class="num">{{product.day}}</text>

<text class="dian"><text>:</text>\n天</text>

<text class="num">{{product.hour}}</text>

<text class="dian"><text>:</text>\n时</text>

<text class="num">{{product.minute}}</text>

<text class="dian"><text>:</text>\n分</text>

<text class="num">{{product.second}}</text>

<text class="dian">\n秒</text>

</view>

</view>

<view wx:elif="{{product.status==2}}">

<view class="title">eeeee</view>

<view class="time">

<text class="num">{{product.day}}</text>

<text class="dian"><text>:</text>\n天</text>

<text class="num">{{product.hour}}</text>

<text class="dian"><text>:</text>\n时</text>

<text class="num">{{product.minute}}</text>

<text class="dian"><text>:</text>\n分</text>

<text class="num">{{product.second}}</text>

<text class="dian">\n秒</text>

</view>

</view>

<view wx:elif="{{product.status==3}}">

<view class="title">rrrrrrr</view>

<view class="time">

<text class="num">{{product.day}}</text>

<text class="dian"><text>:</text>\n天</text>

<text class="num">{{product.hour}}</text>

<text class="dian"><text>:</text>\n时</text>

<text class="num">{{product.minute}}</text>

<text class="dian"><text>:</text>\n分</text>

<text class="num">{{product.second}}</text>

<text class="dian">\n秒</text>

</view>

</view>

<view wx:elif="{{product.status==4}}">

<view class="title">tttttt</view>

<view class="time">

<text class="num">-</text>

<text class="dian"><text>:</text>\n天</text>

<text class="num">-</text>

<text class="dian"><text>:</text>\n时</text>

<text class="num">-</text>

<text class="dian"><text>:</text>\n分</text>

<text class="num">-</text>

<text class="dian">\n秒</text>

</view>

</view>

<button class="button" ><image src="../../img/huopin.gif"></image></button>

</view>

<!-- right -->

</view>

</view>

<!-- groups-item -->

</view>

</view>

</view>

加载中
返回顶部
顶部