如何返回then里面的值???? promotions() {
models.jz_promotions.findAll().then(function (d) { RES_SEND.data = d;
})
return data(RES_SEND);
}
1 回答

尚方宝剑之说
TA贡献1788条经验 获得超4个赞
你是想返回你里面的d?直接返回就可以了。
我感觉你是想在promotions方法调用后返回d 的值把。var aaa = promotions();
你是想这行命令后,aaa的值是d的值吧?
应为promotions里面是异步加载的,且你想获得异步加载的返回值。所以你得这样写:
var aaa = null;function promotions(){ return models.jz_promotions.findAll().then(function (d) { return d; }); } promotions().then(function(d) { aaa = d; });
添加回答
举报
0/150
提交
取消