页面渲染问题
来源:5-8 第五天 微信 JS-SDK
玉林峰
2017-04-09
在g.js中已经有一个this.body = 'wrong'了,为什么还要在app.js中加this.body来渲染页面,这样不冲突吗?
// app.js
app.use(function *(next){
console.log('this.url');
console.log(this.url);
if(this.url.indexOf('42.51.12.57') < -1){
this.body = '<h1>标题</h1>';
return next;
}
yield next;
})写回答
1回答
-
Scott
2017-04-10
如果是 wrong 可以直接返回,不往下执行了
后面的 this.body 的内容,如果不出错的话,会继续往下执行到 xml 变量替换到模板中的过程,最终返回给微信的是 xml 格式数据
00
相似问题