uniapp 做的小程序,发布之后,第一次加载页面空白,下拉刷新后正常,可是在本地和微信开发工具上都没问题!
this.GetNewsList(); //动态获取数据
//setTimeout模拟异步请求数据
setTimeout(() => {
//list = json.newsList;
if (type === 'refresh') {
console.log('刷新');
tabItem.newsList = []; //刷新前清空数组
}
list.forEach(item => {
//item.id = parseInt(Math.random() * 10000);
tabItem.newsList.push(item);
//console.log(tabItem.loadMoreStatus);
})
//下拉刷新 关闭刷新动画
if (type === 'refresh') {
this.$refs.mixPulldownRefresh && this.$refs.mixPulldownRefresh.endPulldownRefresh();
// #ifdef APP-PLUS
tabItem.refreshing = false;
// #endif
tabItem.loadMoreStatus = 0;
}
//上滑加载 处理状态
if (type === 'add') {
tabItem.loadMoreStatus = tabItem.newsList.length > 40 ? 2 : 0;
}
}, 600)
2 个回复
1***@qq.com - 刘灿成
我也遇到这问题,什么原因啊?
6***@qq.com
你们解决了吗?怎么解决的
c***@qq.com (作者)
算是解决了吧!
uni.showLoading({
title: '加载中'
});
axios.post('').then(
(res) => {
this.$nextTick(() => {
list = res.data;
console.log(list);
this.showCard=true;
})
用了一个这个东西:this.$nextTick
2020-03-26 14:21
6***@qq.com
回复 c***@qq.com: 感谢,我马上试试
2020-03-26 22:50