uni-app开发小程序-使用uni.switchTab跳转后页面不刷新的问题

onload中若是接受传参的话必需要传入参数或则作无参数处理!html

uni.showToast({
                                        title: "用户取消付款!",
                                        icon: "none",
                                        success: () => {
                                            setTimeout(() => {
                                                
                                                uni.switchTab({
                                                    url: "../library/library?topIndex=1&subIndex=3",
                                                    success: (res) => {
                                                        console.log('跳转成功',res)
                                                        let data={
                                                            topIndex:1,
                                                            subIndex:3
                                                        }
                                                        let page = getCurrentPages().pop();
                                                        if (page == undefined || page == null) return;
                                                        page.onLoad(data);
                                                    },
                                                    fail: (err) => {
                                                        console.log('跳转失败',err)
                                                    }
                                                })
                                            }, 1500);
                                        }
                                    })

switchTab成功跳转后调用success,此时能够拿到跳转后页面的page对象,从而调用页面onLoad方法重载页面;微信后期应该会加相应的参数来决定是否刷新跳转微信

 

转载于:https://www.cnblogs.com/Dark-fire-liehuo/p/11418002.htmlpost