如果需要傳遞對象需要在傳遞前對對象轉(zhuǎn)為字符串姜胖,然后再新的頁面再轉(zhuǎn)為對象即可。
1.小程序正常的跳轉(zhuǎn)方法是:
appointment(e) {
? ? ? ? console.log(e);
? ? ? ? let str = JSON.stringify(e.currentTarget.dataset.clinic)
? ? ? ? wx.navigateTo({
? ? ? ? ? ? url: '../appointment-register/appointment-register?clinic=' + str
? ? ? ? })
? ? },
2.傳遞個對象過去怎么辦淀散?我的解決辦法是先將對象轉(zhuǎn)換為json字符串然后到下個頁面將json字符串右莱,再轉(zhuǎn)化為對象蚜锨。如下:
onLoad: function(options) {
? ? ? ? console.log(options)
? ? ? ? let clinic = JSON.parse(options.clinic)
}