egg-art-template模板引擎(不实时更新)
1-1 安装
cnpm i egg-view-arttemplate -S
1-2 配置config/plugin.js
module.exports = {arttemplate: {enable: true,package: 'egg-view-arttemplate',}};
1-3 配置config/config.default.js
config.view = {mapping: {'.html': 'arttemplate',},};config.arttemplate = {escape: true,debug: false,bail: true,cache: true};
1-4 app/view
在app目录下,新建view文件夹,放置html页面
1-5 与html页面对应
class HomeController extends Controller {async index() {const { ctx } = this;await ctx.render("home")}}
