小程序开发报错 "errMsg":"showModal:fail parameter error: parameter.content should be String instead of Undefined;"
PHP
0
WAServiceMainContext.js:2 Error: MiniProgramError
{"errMsg":"showModal:fail parameter error: parameter.content should be String instead of Undefined;"}
at Object.errorReport (WAServiceMainContext.js:2)
at Function.thirdErrorReport (WAServiceMainContext.js:2)
at Object.thirdErrorReport (WAServiceMainContext.js:2)
at u (WASubContext.js?t=wechat&s=1665676309127&v=2.17.0:2)
at Object.v [as cb] (WASubContext.js?t=wechat&s=1665676309127&v=2.17.0:2)
at WASubContext.js?t=wechat&s=1665676309127&v=2.17.0:2
at Array.forEach ()
at e.value (WASubContext.js?t=wechat&s=1665676309127&v=2.17.0:2)
at t (WASubContext.js?t=wechat&s=1665676309127&v=2.17.0:2)
at WASubContext.js?t=wechat&s=1665676309127&v=2.17.0:2(env: Windows,mp,1.06.2209070; lib: 2.17.0)
遇一这种错误,大家第一时间,要考虑的,就是接口没正确的返回给我们值,使得我们在设置变量时获得了 Undefined,而报错。
data.currentTab对象中的值应该为字符串"0"
正确的赋值打开方式应该是:this
this.setData({
currentTab: current +""
})
不得不说小程序中的坑真TM多,赋值类型还得是字符串.. 版权声明:除非特别标注原创,其它均来自互联网,转载时请以链接形式注明文章出处。