art-template官网
http://aui.github.io/art-template/zh-cn/koa/index.html
配置art-template
1、安装依赖
yarn add art-template koa-art-template
2、配置信息
const Koa = require('koa');const render = require('koa-art-template');const app = new Koa();render(app, {root: path.join(process.cwd(), 'pages'),extname: '.html',debug: process.env.NODE_ENV !== 'production'});app.use(async function (ctx) {await ctx.render('user');});app.listen(8080);
可以通过这个模块的配置,实现通过后端网址来打开页面,实现跳转
3、语法
1-1 each
{{each movies}}<p>{{$value.title}}</p>{{/each}}
