修改小程序bug

This commit is contained in:
邓洁
2023-02-27 09:54:21 +08:00
parent 055381f224
commit 6a1e71ce8a
8 changed files with 127 additions and 85 deletions

View File

@@ -17,7 +17,7 @@
</view>
</view>
</view>
<view v-if="newsShow" class="no-data">已经到底啦</view>
<view v-if="newsShow==0" class="no-data">已经到底啦</view>
</view>
</template>
@@ -28,20 +28,23 @@
export default {
data() {
return {
newsShow: true,
newsShow: '',
imgUrl: '',
newsList: [],
pageNum: 1, // 当前页
pageSize: 4, // 每页条数
pageSize: 12, // 每页条数
}
},
onLoad() {
this.imgUrl = uni.getStorageSync('img_url')
this.imgUrl = uni.getStorageSync('img_url')
this.getNews()
},
onReachBottom() {
this.pageNum++
this.getNews()
console.log('触底下拉');
if (this.newsShow !== 0) {
this.pageNum++
this.getNews()
}
},
methods: {
getNews() {
@@ -49,10 +52,12 @@
pageSize: this.pageSize,
pageNum: this.pageNum
}).then(res => {
// console.log('行业新闻', res.data.data)
console.log('行业新闻', res.data)
let newsData = res.data.data
for (const item of newsData) {
item.pub_time_str = dateFormat(item.pub_time_str)
this.newsShow = item.length
console.log('this.newsShow', this.newsShow);
}
this.newsList = [...this.newsList, ...newsData]
}).finally(_ => {})