看微信小程序介绍,直接传数组是不行的,因为数据类型会被转化,首先做下处理:
let data = {
id: self.data.id,
answers: JSON.stringify(self.data.answerList)
}
如果是POST请求header头要注意:
if (method == "GET"){
header = { 'content-type': 'application/json'};
} else{
header = { 'content-type': 'application/x-www-form-urlencoded;charset=utf-8'}; //post请求用这个
}