Home >WeChat Applet >Mini Program Development >How to jump to a specified mini program page from outside the mini program_get the link from the mini program page
The links in the mini program use the navigator component
Use the a tag in html, the a tag can link to any address on the network
But the navigator in the mini program can only Applied to the link jump of in the current applet <navigator url="http://www.baidu.com">跳转A</navigator>
<navigator url='test/t'>跳转B</navigator>
The first one is invalid
The second one can jump correctly, it is required Note: The page in the url cannot be the page
in tabBar (bottom menu), but you can set the
redirect attribute through the open-type attribute to open a new page When,
Close the original page(In the new page, you cannot return to the original page)<navigator redirect url='test/t'>跳转</navigator>
When jumping, pass the parameters (
No need to add quotation marks , double quotation marks will be added automatically, otherwise there will be one extra quotation mark, so directly write: id=111&name=张三):<navigator url='test/t?id=111&name=张三'>跳转</navigator>
passed
The event gets the url parameters and automatically puts the parameters into it when loading this page<navigator url='test/t?id=111&name=张三' hover-class='hoverClass'>跳转</navigator> <!--链接1-->
<navigator url='test/t?id=123&name=小明'>跳转</navigator> <!--链接2-->
Page({
data: {
},
onLoad : function(datas) {
console.log(datas);
}
})
If you click link 1, the value of datas is {id: "111", name: "张Three"}, click link 2, then the value of datas is {id: "123", name: "Xiao Ming"}
hover-class is the style after clicking on it
wx.navigateToThis Api can also complete page jump, which is the same as navigator (without redirect attribute)
<button size='mini' bindtap="navigator">跳转</button>
navigator : function() { wx.navigateTo({ url: 'test/t?id=100&user=xiaoming', success : function(e) { console.log(e.errMsg); } }) }wx.redirectTo
This Api can also complete page jump, which is the same as navigator (with redirect attribute), and the operation is the same as above
wx.navigateBackThis Api is used to return , Return to the upper-level page from the current page (according to the following parameters)
Page({ data: { }, back : function() { wx.navigateBack({ delta : 1 // 值为1, 则是返回上一级, 值为2就返回上两级... }) } })
If the value of dellta is 1, you do not need to write the dellta attribute: wx.navigateBack({})
If the value of dellta If the value exceeds the total level that
can be returned, it will return to the home pageRelated articles:
Link to this pageWeChat Mini Program Component: Navigator Page Link Interpretation and Analysis Page Links and Multimedia-WeChat Mini Program Program project practical video tutorialThe above is the detailed content of How to jump to a specified mini program page from outside the mini program_get the link from the mini program page. For more information, please follow other related articles on the PHP Chinese website!