uni-app以及微信小程序页面跳转后页面自动刷新并显示第一页信息refreshData()

前提:在数据很多有分页的情况下:
在子页面点击按钮,跳转到上一层页面或者首页,然后让其页面自动刷新,并显示第一页的数据。
问题解决

列表详情页面组件:


<view class="bottomBtn">
	<button type="submit" @click="checkout">确认创建</button>
</view>

点击按钮跳转到列表页面:

checkout(){
	this.$Net.postAction(this.$api.saveServiceOrder, param, 1).then(res => {
		this.$Toast.message("创建成功");
		uni.navigateBack();
	}).catch(er => {
				console.log(er)
	});
}

列表list页面:

<template>
	<view class="">
		<view class="orderList">
			<empty :list="listData" tips='暂无订单' :type='1' mode="order">
				<view class="uni-form-item uni-column" v-for="(item,index) in listData" :key="index"
					@click="onOrderdetail(item.serviceOrderId)">
					<view class="text Order">
						<view class="textOrder">系统编号:{{item.orderNo || '无'}}</view>
						<view class="viewBtn">查看详情</view>
					</view>
					<view class="text">服务名称:{{item.serviceName || '无'}}</view>
					<view class="text">类型:{{item.serviceRecipientType || '无'}}</view>
				</view>
			</empty>
			<uni-load-more :status="refreshStatus" :content-text="contentText" color="#999" />
		</view>
		<view class="bottomBtn">
			<button class="addOrder" type="submit" @click="OnOrder()">创建订单</button>
		</view>
	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex'
	import Refresh from '@/mixins/refresh'
	import uniLoadMore from '@/components/uni-load-more'
	
	export default {
		data() {
			return {
				listData: []
			}
		},
		components: {
			uniLoadMore
		},
		mixins: [Refresh],
		computed: {
			...mapState([
				'username'
			])
		},
		onLoad(option) {
		},
		onShow() {
			this.refreshData(); //页面自动刷新
		},
		methods: {
			getList(status) {
				Object.assign(this.searchReq, {
					uplusLoginId: this.username
				})
				this.$Net.postAction(this.$api.orderList, this.searchReq, 1).then(res => {
					if (res.code == 200) {
						const {
							totalPages,
							content
						} = res.data;
						this.setStatus(totalPages, content, status)
					}
				})
			}
		}
	}
</script>


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值