Get the App
SLTechnology News&Howtos  ›  Development  › 

How does Mini Program realize the home page jump back to the sharing page?

Shulou Source: shulou.com Published: 2022-06-01 07:06:51 10月02日 Update

In this article, the editor introduces in detail "how Mini Program can achieve the home jump back to the sharing page". The content is detailed, the steps are clear, and the details are handled properly. I hope that this "how Mini Program to achieve the home page jump back to the sharing page" article can help you solve your doubts. Let's follow the editor's ideas to slowly deepen, let's learn new knowledge.

Doing Mini Program development found that after the page is shared, it is difficult for users to find the situation of returning to the home page through the page they share. The official operation of Wechat is to click on the three points in the upper right corner and display it at the bottom of the phone to return to the home page. Many folk programs are to add a floating Home tag on the page.

Today I share another way. Please look at the .gif below

Have you noticed that there is a back button in the upper left corner? The principle is simple, on the page you want to share, configure your home page when sharing the configuration, and take the corresponding parameters, which can be obtained in the home page onLoad method. The code is as follows:

Const app = getApp ()

Page ({

Data: {

Motto: 'Hello World'

UserInfo: {}

HasUserInfo: false

CanIUse: wx.canIUse ('button.open-type.getUserInfo')

}

/ / event handling function

GoLogs: function () {

Wx.navigateTo ({

Url:'/ pages/logs/logs'

})

}

OnLoad: function (options) {

Console.log (options)

If (options.share_query) {

Wx.showLoading ({

Title:'I entered from the sharing page'

})

SetTimeout (function () {

Wx.hideLoading ()

Wx.navigateTo ({

Url:'/ pages/logs/logs'

})

}, 2000)

}

}

})

{{index + 1}}. {{log}}

Const app = getApp ()

Page ({

Data: {

Motto: 'Hello World'

UserInfo: {}

HasUserInfo: false

CanIUse: wx.canIUse ('button.open-type.getUserInfo')

}

/ / event handling function

GoLogs: function () {

Wx.navigateTo ({

Url:'/ pages/logs/logs'

})

}

OnLoad: function (options) {

Console.log (options)

/ / determine whether to share access

If (options.share_query) {

Wx.showLoading ({

Title:'I entered from the sharing page'

})

SetTimeout (function () {

Wx.hideLoading ()

Wx.navigateTo ({

Url:'/ pages/logs/logs'

})

}, 2000)

}

}

})

After reading this, the article "how to achieve Mini Program sharing page to return to the home page" has been introduced. If you want to master the knowledge of this article, you still need to practice and use it yourself. If you want to know more about related articles, welcome to follow the industry information channel.

Tags: Page home page program article handling event content function method configuration proper three code principle parameter official upper left corner idea situation mobile phone Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Microsoft vpn Apple Huawei