一、在布局里面
A頁面?zhèn)鲄?/p>
<navigator url="../coursedetail/coursedetail?參數(shù)名字={{要傳遞的參數(shù)值}}&&參數(shù)名字={{參數(shù)值}}">
</navigator>
B頁面接收參數(shù)
二岗屏、在js里面
url編碼:encodeURIComponent(url)?
url解碼:decodeURIComponent(options.video_url)
? wx.navigateTo({
? ? ? ? url: '../video/video?video_url=' + encodeURIComponent(url) + '&&leftTime=' + lefttime+'',
? ? ? });
A頁面?zhèn)鲄?/p>
B頁面接收參數(shù):
三默蚌、頁面之間傳遞對象
頁面一
頁面二
如果傳遞的數(shù)據(jù)中包含特殊字符冻晤,需要編碼解碼
頁面1:
var goodsInfo = encodeURIComponent(JSON.stringify(this.data.goodsInfo));//encodeURIComponent函數(shù)可把字符串作為URI組件傳遞
頁面2:
// 先解碼,再轉(zhuǎn)成json
var goodsInfo1 = decodeURIComponent(options.goodsInfo);
var goodsInfo = JSON.parse(goodsInfo1);