问题
一直在videoInfo.视频地址,我就说为啥undefined,原来是上个页面的参数传到下一个页面 问号导致后面参数丢失的问题,所以获取参数就报了undefined
wx.navigateTo({
url: '../videoinfo/videoinfo?videoInfo='+videoInfo,
})
onl oad: function (params) {
var me = this;
me.videoCtx = wx.createVideoContext("videoId", me);
console.log("===================="+params)
console.log("===================="+JSON.stringify(params))
}
解决办法
参考微信开放社区大佬的评论
这种路径参数传递前先编下码,使用
encodeURIComponent
先编码,之后使用
decodeURIComponent
解码
wx.navigateTo({
url: '../videoinfo/videoinfo?videoInfo='+encodeURIComponent(videoInfo),
})
onl oad: function (params) {
//var me = this;
//me.videoCtx = wx.createVideoContext("videoId", me);
console.log("===================="+params.videoInfo)
console.log("===================="+decodeURIComponent(params.videoInfo))
}
标签:navigateTo,me,console,log,params,丢失,videoInfo,wx
From: https://www.cnblogs.com/rzkwz/p/16871074.html