cannot read property ‘song‘ of undefined TypeError: Cannot read property ‘song‘ of undefined

在这里插入图片描述

WAServiceMainContext.js:2 Uncaught FrameworkError 
 Cannot read property 'song' of undefined 
 TypeError: Cannot read property 'song' of undefined
    at Br.onLoad (http://127.0.0.1:19738/appservice-hotreload/pages/songDetail/songDetail.js?=1;:34:35)
    at l.<anonymous> (http://127.0.0.1:19738/appservice/__dev__/WASubContext.js?t=wechat&s=1657708501318&v=2.19.4:2:2215235)
    at http://127.0.0.1:19738/appservice/__dev__/WASubContext.js?t=wechat&s=1657708501318&v=2.19.4:2:2169442
    at D (http://127.0.0.1:19738/appservice/__dev__/WASubContext.js?t=wechat&s=1657708501318&v=2.19.4:2:2085826)
    at http://127.0.0.1:19738/appservice/__dev__/WASubContext.js?t=wechat&s=1657708501318&v=2.19.4:2:2169255
    at Array.forEach (<anonymous>)
    at http://127.0.0.1:19738/appservice/__dev__/WASubContext.js?t=wechat&s=1657708501318&v=2.19.4:2:2169239
    at Array.forEach (<anonymous>)
    at http://127.0.0.1:19738/appservice/__dev__/WASubContext.js?t=wechat&s=1657708501318&v=2.19.4:2:2169168
    at http://127.0.0.1:19738/appservice/__dev__/WASubContext.js?t=wechat&s=1657708501318&v=2.19.4:2:2169517(env: Windows,mp,1.06.2206090; lib: 2.19.4)

看到这个错误,一般是JSON.parse编译错误,主要原因是JSON.parse将json对象反编译成js对象
在微信小程序中,使用url的query形式传参,传参的长度有限制,长度太长被截取了,所以报错


版权声明:本文为weixin_48952990原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。