success: function (res) {
self1.setData({'testquestion[${str}]': res.result.data }); 在回调函数中此句的${str}部分无法用传递的参数str,但换成数字2就可以,如何改?谢谢啦!
callback() //回调
}
如何将回调函数中返回值传给数组中指定行?How to pass the return value in the callback function to the specified row in the array?
如何将回调函数中返回值传给数组中指定行?success: function (res) {
self1.setData({'testquestion[${str}]': res.result.data }); 在回调函数中此句的${str}部分无法用传递的参数str,但换成数字2就可以,如何改?谢谢啦!
callback() //回调
}
success: function (res) { self1.setData({'testquestion[${str}]': res.result.data }); in the callback function, the ${STR} part of this sentence cannot use the passed parameter STR, but it can be replaced by the number 2. How to change it? Thank you! Callback() / / callback}
回答:
{`testquestion[${str}]`: res.result.data }
${}别乱用啊,不是用单引号,是反引号
原文出处:如何将回调函数中返回值传给数组中指定行?
self1.setData({testquestion[str]: res.result.data });