跳转前页面js文件
小程序
var value = encodeURIComponent(`http://wxsnsdy.tc.qq.com/105/20210/snsdyvideodownload?filekey=30`);ide
wx.navigateTo({this
url: "../video/video?source=" + value,url
})spa
跳转后页面js文件code
data: {字符串
src_list: null,io
},function
onLoad: function (options) {file
this.setData({ src_list: decodeURIComponent(options.source)})
},
一、小程序页面跳转传参其中一种方法是:使用?后面加须要传递的参数,如上文中的source参数。
二、若是navigateTo传递的参数自己携带?,能够使用encodeURIComponent和decodeURIComponent编解码,不然会被截断,致使?后面的数据没法传递后跳转页面。
三、对于多行字符串,能够使用反引号``拼接,避免使用一大堆 和加号。