uni-app使用uni.navigateTo傳遞對(duì)象參數(shù)示例代碼
一、傳遞一般參數(shù)
const index = 1;
uni.navigateTo({
url: `../address/address?key=${index}`
})二、傳遞對(duì)象參數(shù)
1.傳遞參數(shù)
// 跳轉(zhuǎn)到訂單詳情頁面
toOrder(item) {
// console.log(item.hpv_id, 'hpv_id')
uni.navigateTo({
url: '../hpvOrder-detail/hpvOrder-detail?key=' + encodeURIComponent(JSON.stringify(item))
})
}2.接收參數(shù)
navigateTo進(jìn)行頁面?zhèn)鬟f參數(shù),在下一個(gè)頁面接收數(shù)據(jù),一般在在onLoad鉤子函數(shù)中獲取
onLoad(e) {
this.detail = JSON.parse(decodeURIComponent(e.key));
console.log(this.detail)
}附:多個(gè)對(duì)象的傳遞
index頁面?zhèn)鬟f:
uni.navigateTo({
url: '/pages/setSeal/index?seal=' + encodeURIComponent(JSON.stringify(seal)) + '&cStorageModel' + encodeURIComponent(JSON.stringify(cStorageModel))
});home頁面接收:
onLoad(option){
this.pageModel.sealAuth = JSON.parse(decodeURIComponent(option.sealAuth));
this.pageModel.cStorageModel = JSON.parse(decodeURIComponent(option.cStorageModel));
},總結(jié)
到此這篇關(guān)于uni-app使用uni.navigateTo傳遞對(duì)象參數(shù)的文章就介紹到這了,更多相關(guān)uni.navigateTo傳遞對(duì)象參數(shù)內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
一個(gè)輕量級(jí)的XHTML右鍵菜單[支持IE和firefox]
一個(gè)輕量級(jí)的XHTML右鍵菜單[支持IE和firefox]...2007-01-01
js簡單實(shí)現(xiàn)點(diǎn)擊左右運(yùn)動(dòng)的方法
這篇文章主要介紹了js簡單實(shí)現(xiàn)點(diǎn)擊左右運(yùn)動(dòng)的方法,實(shí)例分析了javascript實(shí)現(xiàn)左右運(yùn)動(dòng)的相關(guān)要點(diǎn)與技巧,非常具有實(shí)用價(jià)值,需要的朋友可以參考下2015-04-04
JavaScript實(shí)現(xiàn)相冊彈窗功能(zepto.js)
這篇文章主要介紹了JavaScript基于zepto.js實(shí)現(xiàn)相冊彈窗功能的相關(guān)資料,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2016-06-06

