Use laytpl to render view files for ThinkJS 3.x
npm install think-view-laytpl
edit config file src/config/adapter.js
, add options:
const laytpl = require('think-view-laytpl');
exports.view = {
type: 'laytpl',
common: {
viewPath: path.join(think.ROOT_PATH, 'view'),
extname: '.html',
sep: '_' //seperator between controller and action
},
laytpl: {
handle: laytpl,
options: {
open: '{{', //分隔符-开始
close: '}}', //分隔符-结束
cache: false, //是否缓存
min: true //是否开启压缩
}
}
}