微信小程序用web-view打开页面的话,链接有时候会有参数,参数之间会有问号(?),但是小程序传参不能带问号,会丢,所以要接解析一下,传的时候:

   /**
     * 查看物流轨迹地图
     */
    seeMap(e) {
        let id = e.currentTarget.dataset.id
        wx.navigateTo({
            url: '/pages/game1/index?mapurl=' + encodeURIComponent(id)
        })
    }

接参的时候:

   /**
     * 生命周期函数--监听页面加载
     */
    onLoad(options) {
        this.setData({
            mapurl:decodeURIComponent(options.mapurl)
        })
    },

标签: none

添加新评论