我有一个名为“ReportOptions_Timeframe”的预编译模板。当我调用Handlebars.templates.ReportOptions_Timeframe(data)时,我没有得到渲染模板html。相反,我得到了输出:
“功能(把手,深度0,助手,部分,数据){
this.compilerInfo = [4,'> = 1.0.0']; helpers = this.merge(帮助者, Handlebars.helpers); data = data || {}; var buffer =“”,stack1, helper,functionType =“function”, escapeExpression = this.escapeExpression,self = this;function program1(depth0,data){ var buffer =“”;缓冲区+ =“\ r \ n” + escapeExpression((typeof depth0 === functionType?depth0.apply(depth0):depth0)) +“\ r \ n”;返回缓冲区; }
buffer + =“Term:\ r \ n \ r \ n”; stack1 = helpers.each.call(depth0, (depth0&& depth0.TermList), {hash:{},inverse:self.noop,fn:self.program(1,program1, 数据),数据:数据}); if(stack1 || stack1 === 0){buffer + = stack1; } buffer + =“\ r \ n \ r \ n \ r \ n \ r \ n \ r \ n日期范围:\ r \ n \ r \ n \ n \ r \ n \ n”;返回缓冲区; }“
我做错了什么?
编辑添加预编译模板:
(function(){var template = Handlebars.template,templates = Handlebars.templates = Handlebars.templates || {}; templates ['ReportOptions_Timeframe'] =模板(功能 (Handlebars,depth0,helpers,partials,data){this.compilerInfo = [4,'> = 1.0.0']; helpers = this.merge(helpers,Handlebars.helpers); data = data || {};
返回“功能(Handlebars,depth0,helpers,partials,data){\ n this.compilerInfo = [4,'> = 1.0.0']; \ nhelpers = this.merge(帮手, Handlebars.helpers); data = data || {}; \ n var buffer = \“\”,stack1, helper,functionType = \“function \”, escapeExpression = this.escapeExpression,self = this; \ n \ nfunction program1(depth0,data){\ n \ n var buffer = \“\”; \ n buffer + = \“\ r \ n \”\ n + escapeExpression((typeof depth0 === functionType?depth0.apply(depth0):depth0))\ n + \“\ r \ n \”; \ n返回 缓冲区; \ n} \ n \ n缓冲区+ = \“术语:\ r \ n \ r \ n \”; \ n stack1 = helpers.each.call(depth0,(depth0&& depth0.TermList), {hash:{},inverse:self.noop,fn:self.program(1,program1, 数据),数据:数据}); \ n if(stack1 || stack1 === 0){buffer + = stack1; } \ n缓冲区+ = \“\ r \ n \ r \ n \ r \ n \ r \ n \ r \ n日期范围:\ r \ n \ r \ n \ n \ r \ n \ n \ n”; \ n \ n \ n返回缓冲区; \ n}“;});})();
答案 0 :(得分:0)
我给了节点错误的输入文件。我以前使用的输入文件已经预先编译过了。