从A页面携带参数succeedShow跳转至B页面.
A页面代码:
携带参数跳转,succeedShow为true
wx.navigateTo({
url: '/pages/index/detail?id=' + id + '&succeedShow=false'
})
B页面接管参数,
会发现,你本意要传的布尔值:false,会变成字符串:false。。。导致你的判断不成立;
原本错误代码:
succeedShow: options.succeedShow ? options.succeedShow :false,
纠正一下,
以下为正确写法:
succeedShow: (options.succeedShow == "true" ? true : false),
大吉,愿世界再无bug。。。嘻嘻
发表回复