如何实现一个异步设置body的问题 ~~·
app.use(function*() {
setTimeout(function(){
// 在这里设置body
this.body = '111111'
}.bind(this),1000)
});
如何实现一个异步设置body的问题 ~~·
app.use(function*() {
setTimeout(function(){
// 在这里设置body
this.body = '111111'
}.bind(this),1000)
});
app.use(function*() {
var _this=this;
setTimeout(function(){
// 在这里设置body
this.body = '111111'
}.bind(this),1000)
});
app.use(function*() {
yield function(cb){
setTimeout(function(){
cb();
this.body = 100
}.bind(this),1000)
};
});
5 回答4.8k 阅读✓ 已解决
4 回答2.5k 阅读✓ 已解决
2 回答1.7k 阅读✓ 已解决
5 回答1.9k 阅读
2 回答1.3k 阅读✓ 已解决
3 回答2k 阅读
1 回答3.2k 阅读
app.use(function*() {
});
看懂Co框架的实现才能弄懂koa回调的原理