功能是发帖后,然后展示帖,展示帖可以向下滑动,然后滑到下面就卡住了。
js部分代码
Page({
data: {},
e(t, "hasMoreData", !0),
。。。
onReachBottom: function () {
this.data.hasMoreData ? (this.setData({
reachBottom: !0
}), this.ShowBbs1("")) : this.setData({
morestr: "没有更多了"
});
},
wxml代码
<template name="txt">
<view class="content">
<text space="nbsp" userSelect="true">{{item.data}}</text>
</view>
<view style="height:5px;"></view>
</template>
<template name="img">
<view>
<image bindload="imageLoad" bindtap="previewImage" data-index="{{item.orders}}" data-src="{{item.data}}" lazyLoad="{{true}}" src="{{item.datas}}" style="width:{{images[item.orders].width}}rpx; height:{{images[item.orders].height}}rpx;"></image>
</view>
</template>
<scroll-view>
<view class="body" wx:if="{{loaded}}">
<view hidden="true">
<input name="current" value="{{current}}"></input>
<input name="maxorder" value="{{maxorder}}"></input>
<input name="followk" value="{{followk}}"></input>
<input name="tid" value="{{tid}}"></input>
<input name="tel" value="{{tel}}"></input>
</view>
<view class="card">
<view class="topic">
<text space="nbsp" userSelect="true">{{words[0].subject}}</text>
</view>
<view class="flex" style="width:98%;margin-top:10rpx;" wx:for="{{words[0].img_arr}}" wx:for-item="item" wx:key="key">
<image src="{{item}}"></image>
</view>
<view class="userinfo">
<view class="userpic">
<image src="{{words[0].avatar}}" style="width:60rpx;height:60rpx;border-radius:50rpx;"></image>
</view>
<view class="username">
<view class="author">{{words[0].author}} <text class="level" style="background-color:{{words[0].namecolor}};">{{words[0].userlevel}}</text>
</view>
<view class="userlevel">
<view class="date">{{words[0].dateline}}</view>
<view wx:if="{{adminrole || words[0].isauthor}}">
<button bindtap="delMybbs" class="reply" hoverClass="none" id="{{words[0].tid}}">删除</button>
</view>
<view class="views">跟帖:{{words[0].replies}}条</view>
<view class="views">浏览:{{words[0].views}}次</view>
</view>
</view>
</view>
<view class="line"></view>
<view style="height:5px;"></view>
<view bindlongtap="bingLongTap" bindtouchend="bindTouchEnd" bindtouchstart="bindTouchStart" class="flex" data-title="{{words.subject}}" id="{{words.tid}}" style="width:100%">
<view class="content">
<view class="content">报名时间:{{words[0].signtime}}</view>
<view class="content">活动时间:{{words[0].acttime}}</view>
<view class="content">活动地点:{{words[0].actplace}}</view>
<view class="content">活动人数:{{words[0].signnum}}</view>
<view class="content">联系电话:{{words[0].contactphone}}</view>
<view class="content">活动费用:{{words[0].cost}}</view>
<view class="content">{{words[0].message}}</view>
</view>
</view>
</view>
<view class="h_line"></view>
<view data-num="{{index}}" style="display:flex;width:96%;background-color:#fff;flex-direction:column;padding:10rpx;margin-left:10rpx;margin-top:10rpx;" wx:for="{{contentlist}}" wx:key="key">
<view class="userinfo" style="margin-left:10rpx;">
<view class="userpic">
<image mode="widthFix" src="{{item.avatar}}" style="padding:0rpx;width:60rpx;height:60rpx;border-radius:50rpx;"></image>
</view>
<view class="username" style="margin-top:16rpx;">
<view class="author" style="color:#4a6495">{{item.author}} <text class="level" style="background-color:{{item.namecolor}};">{{item.userlevel}}</text>
</view>
</view>
</view>
<view bindlongtap="DelBbs" bindtouchend="bindTouchEnd" bindtouchstart="bindTouchStart" data-title="{{item.subject}}" id="{{item.id}}" style="padding-left:70rpx;">
<view class="pid_str" wx:if="{{item.parent_id != item.ancestor_id}}">
<view style="width:100%">{{item.subject}}</view>
<view style="width:100%">{{item.subject2}}</view>
</view>
<view class="content">
<view style="width:100%">{{item.message}}</view>
</view>
<view class="flex" style="width:94%;margin-top:10rpx;" wx:for="{{item.img_arr}}" wx:for-item="item2" wx:key="key">
<image src="{{item2}}"></image>
</view>
<view class="flex" style="width:95%">
<view wx:for="{{item.title}}" wx:for-index="idx" wx:for-item="item1" wx:key="key">
<view wx:if="{{item1.type=='img'}}">
<image bindload="imageLoad1" bindtap="previewImage" class="content-img" data-index="{{item1.orders}}" data-src="{{item1.data}}" src="{{item1.datas}}" style="width:{{images[item1.orders].width}}rpx; height:{{images[item1.orders].height}}rpx;"></image>
</view>
<view style="margin-left:5rpx;margin-right:5rpx;" wx:elif="{{item1.type=='mote'}}">
<image bindload="imageLoad1" class="content-img" data-index="{{item1.orders}}" data-src="{{item1.data}}" src="{{item1.datas}}" style="width:{{images[item1.orders].width}}rpx; height:{{images[item1.orders].height}}rpx;"></image>
</view>
<view wx:else>
<view class="content_r">
<text space="nbsp" userSelect="true">{{item1.data}}</text>
</view>
<view style="height:5px;"></view>
</view>
</view>
</view>
<view class="flex" style="width:95%">
<view wx:for="{{item.content}}" wx:for-index="idx" wx:for-item="item1" wx:key="key">
<view wx:if="{{item1.type=='img'}}">
<image bindload="imageLoad1" bindtap="previewImage" class="content-img" data-index="{{item1.orders}}" data-src="{{item1.data}}" src="{{item1.datas}}" style="width:{{images[item1.orders].width}}rpx; height:{{images[item1.orders].height}}rpx;"></image>
</view>
<view style="margin-left:5rpx;margin-right:5rpx;" wx:elif="{{item1.type=='mote'}}">
<image bindload="imageLoad1" class="content-img" data-index="{{item1.orders}}" data-src="{{item1.data}}" src="{{item1.datas}}" style="width:{{images[item1.orders].width}}rpx; height:{{images[item1.orders].height}}rpx;"></image>
</view>
<view wx:else>
<view class="content_r">
<text space="nbsp" userSelect="true">{{item1.data}}</text>
</view>
<view style="height:5px;"></view>
</view>
</view>
</view>
<view class="r_date">
<view class="lou">#{{index+2}}</view>
<view>{{item.dateline}}</view>
<button bindtap="reply" class="reply" hoverClass="none" id="{{item.tid}}">回复</button>
<view wx:if="{{adminrole || item.isauthor}}">
<button bindtap="delMybbs" class="reply" hoverClass="none" id="{{item.tid}}">删除</button>
</view>
</view>
</view>
<view class="line"></view>
</view>
<view wx:if="{{reachBottom}}">
<view style="padding:10rpx;height:50rpx;text-align:center;">{{morestr}}</view>
</view>
<view id="bottom" style="height:200rpx;"></view>
</view>
</scroll-view>
<view bindtap="hide_bg" class="page_bg" wx:if="{{block}}">
<view class="btn_bg" wx:if="{{block}}">
<view wx:for="{{infos.tels}}" wx:key="key">
<button bindtap="tel" class="sp_tit" id="{{item.number}}">拨打 {{item.number}} </button>
</view>
</view>
</view>
<view id="recordWrapper"></view>
<view class="bottom" wx:if="{{loaded}}">
<view >
<view class="input">
<button bindtap="reply" class="input_txt_left" hoverClass="none" id="{{words[0].tid}}">
<image src="image/input.png" style="vertical-align:middle;width:36rpx;height:42rpx;"></image>
<text> 回复楼主 已有{{words.replies}}条回复</text>
</button>
<button class="share" id="{{words[0].tid}}" openType="share">
<image src="image/share.png" style="vertical-align:middle;width:45rpx;height:40rpx;"></image>
</button>
</view>
</view>
</view>
e.setData({
loaded: 1,
// act: 0,
// sharetit: res.data.subject
words: res.result.data,
hasMoreData:!1, 增加了这个就可以了。
onReachBottom: function () {
this.data.hasMoreData ? (this.setData({
reachBottom: !0
}), this.ShowBbs1("")) : this.setData({
morestr: "没有更多了"
});
},