try {
res = await mysql.query("select materialdata from group_tea_relations where tea_id=?",[teaIds[i].tea_id])
} catch(e) {
console.error(e)
}
var datas=[]
if(res[0].materialdata){
datas=JSON.parse(res[0].materialdata)
}
写到这 神奇的就是可以直接console.log(datas) 但是 console.log(datas.length)就不行
也无法使用它的长度开启循环 后 找到一篇博客:
js无法获取数组长度_js 获取数组长度报错怎么回事_西瓜喵的博客-CSDN博客
完美解决