uniapp 微信小程序 页面无数据问题记录

uniapp yekong 1457℃

uniapp微信小程序首页进入子页后,再返回首页会重新请求数据,当用户下滑后,请求了第二页第三页的数据后,用户进入子页再返回首页会导致第一页数据的丢失
是因为重新请求数据没有重置页数,虽然重新数据请求但是页数还是之前的页数,重置一下页数就可以了。

问题代码

getdata() {
				var that = this;
				caseFindList({
					"pageNum": that.pageNum,
					"pageSize": that.pageSize,
					"excellent": 1,
					"rand": 0
				}).then(res => {
					if (res.code == 200) {
						that.list = res.data.list
					}
				}).catch(err => {

				})
			},

解决代码

getdata() {
				var that = this;
				that.pageNum = 1
				caseFindList({
					"pageNum": that.pageNum,
					"pageSize": that.pageSize,
					"excellent": 1,
					"rand": 0
				}).then(res => {
					if (res.code == 200) {
						that.list = res.data.list
					}
				}).catch(err => {

				})
			},
喜欢 (1)