This time I will bring you the mini program sharing pageReturn to the previous pageDetailed explanation of the steps, what are theprecautionsfor returning to the previous page from the mini program sharing page, the following is a practical case , let’s take a look.
Today I will share another method. Please look at the .gif below;
Have you noticed that there is a return button in the upper left corner? The principle is simple. On the page you want to share, configure your homepage when sharing the configuration, and bring the corresponding parameters, which can be obtained in the homepageonLoadmethod. The code is as follows:
const app = getApp() Page({ data: { motto: 'Hello World', userInfo: {}, hasUserInfo: false, canIUse: wx.canIUse('button.open-type.getUserInfo') }, //事件处理函数 goLogs: function() { wx.navigateTo({ url: '/pages/logs/logs' }) }, onLoad: function (options) { console.log(options) if (options.share_query){ wx.showLoading({ title: '我是从分享页面进入的', }) setTimeout(function () { wx.hideLoading() wx.navigateTo({ url: '/pages/logs/logs', }) }, 2000) } } }) 我是首页 const app = getApp() Page({ data: { motto: 'Hello World', userInfo: {}, hasUserInfo: false, canIUse: wx.canIUse('button.open-type.getUserInfo') }, //事件处理函数 goLogs: function() { wx.navigateTo({ url: '/pages/logs/logs' }) }, onLoad: function (options) { console.log(options) //判断是否分享进入 if (options.share_query){ wx.showLoading({ title: '我是从分享页面进入的', }) setTimeout(function () { wx.hideLoading() wx.navigateTo({ url: '/pages/logs/logs', }) }, 2000) } } }) {{index + 1}}. {{log}}
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the PHP Chinese website!
Recommended reading:
Detailed explanation of the steps for Vue to convert html strings into HTML
Detailed explanation of the ElTableColumn extension method
The above is the detailed content of Detailed explanation of the steps to return to the previous page on the mini program sharing page. For more information, please follow other related articles on the PHP Chinese website!