Janking

Results 11 comments of Janking

我是在koa-router里面判断 代码如下 router.get('/user',async (ctx) =>{ await ctx.render('aaaa') } ) 关闭debug,页面输出 template error,状态码200

通过这种方式解决我的问题 ``` try { ctx.render(src, { title: title[type], type: type }) } catch (err) { ctx.state.errMsg = err.toString() await next() } ``` 只是这样感觉很不优雅。

render()方法并没有返回任何值,我的理想状态(不成熟想法)是这样: ``` router.get('/user/index',async (ctx,next)=>{ async ctx.render(‘user/index’).catch((err)=>{await next()}) }) ```

最近在阅读 art-template 的源码,如果能看懂,会提个pr

我在这个位置加了async,是可以解决我的问题,你看看合不合理? https://github.com/aui/koa-art-template/blob/master/src/index.js#L30 ``` // koa-art-template/index.js app.context.render = async function (view, _context) {// ...} ``` ``` //my js file router.get('/user/index',async (ctx,next)=>{ ctx.render(‘user/index’).catch((err)=>{await next()}) }) ``` 不好意思,前面忘了补充我用的是`koa-art-template`,跑错地方来提issue了。

@hyingreborn https://github.com/aui/art-template#兼容性 在这是有说只兼容IE8+的

你好,谢谢提出一个好需求,我将会在下个版本中实现