webview---小程序-----webivew 返回时如何同步状态?

小程序 文章 2021-03-06 16:41 0 31 全屏看文

webview---小程序-----webivew 返回时如何同步状态?webview---small program-----how to synchronize the status when webivew returns?

webview---小程序-----webivew 返回时如何同步状态?




In the WebView page a of wechat applet, use wx.navigateTo Jump to applet page B. after completing one click login logic on applet page B, jump to WebView page C with parameters. At this time, WebView page C requests an interface, and then returns to WebView page a step by step. The status of page a will not be synchronized, and the data in the interface of just started page C cannot be obtained, How do you synchronize it? 1. If I want to refresh WebView page a, how do I refresh? I have tried the online refresh scheme, and I always refresh to page C instead of page A. 2. If I carry parameters when page B returns to a, how do I carry them wx.navigateBack Come back


小程序页面B ==》 webview页面A    可以在url带上参数  wx.navigateTo({url: '/pages/webview?参数'})  如果有这个参数就刷新呗




data: {    src:''  // 这里填写页面默认的地址  },  onLoad: function (options) {    console.log(options);    if(options && options.src != undefined){          let src = decodeURIComponent(options.src);      src = src.replace(/http:///, "https://");      this.setData({        src: src      })    }  },


<web-view src="/uploads/cj/article/2021/03/06/95ef2cfb3513bcae15d4c665c58c0a54.jpg"></web-view>


wx.reLaunch({	url: '/pages/index/index?src=' + src,})

页面A wx.redirect -》 页面B wx.redirect 页面C -》wx.redirect +参数至 页面A