跳转页面参数丢失问题
发布于 5 年前 作者 junliao 5265 次浏览 来自 问答

wx.navigateTo({

    url: `/pages/hotel-detail/hotel-detail?url=https://www.baidu.com/?tn=62095104_26_oem_dg`,

})

通过跳转页面,在hotel-detail页面onload拿到的options是{url: ‘https://www.baidu.com’}这样的,没法拿到tn=62095104_26_oem_dg参数

2 回复
wx.navigateTo({
    url: '/pages/hotel-detail/hotel-detail?url=' + encodeURIComponent('https://www.baidu.com/?tn=62095104_26_oem_dg')
})
onLoad: function (options) {
    let url = decodeURIComponent(options.url)
    console.log(url)
}

多个参数不是应该用&连接吗

回到顶部