mirror of
https://github.com/thinkjs/thinkjs.git
synced 2026-01-25 14:42:47 +00:00
21 lines
611 B
JavaScript
21 lines
611 B
JavaScript
/**
|
||
* 调用对应的模版引擎解析模版
|
||
* @return {[type]} [description]
|
||
*/
|
||
module.exports = Behavior(function(){
|
||
'use strict';
|
||
return {
|
||
run: function(data){
|
||
var file = data.file;
|
||
//将模版文件路径写入到http对象上,供writehtmlcache里使用
|
||
this.http.tpl_file = file;
|
||
var engine = C('tpl_engine_type');
|
||
//不使用模版引擎,直接返回文件内容
|
||
if (!engine) {
|
||
return getFileContent(file);
|
||
}
|
||
var engineClass = ucfirst(engine) + 'Template';
|
||
return thinkRequire(engineClass).fetch(file, data.var);
|
||
}
|
||
};
|
||
}); |