我最近将节点刀片智能包添加到我的流星中,并且静态内容显示良好。但是,我无法使用任何模板变量。在我安装 Blade 之前,模板变量与车把配合得很好。有人知道我做错了什么吗?
控制台输出
ReferenceError: player is not defined
at ~/meteor/project/views/info.blade:1:1
1 > .player-name.large= player.name
2 | .alliance-name= alliance.name
3 | .world-name= world.name
4 |
at eval (eval at <anonymous> (/usr/local/lib/node_modules/blade/lib/compiler.js:138:23))
at /usr/local/lib/node_modules/blade/lib/runtime.js:323:5
at runtime.loadTemplate (/usr/local/lib/node_modules/blade/lib/runtime.js:272:6)
at /usr/local/lib/node_modules/blade/lib/blade.js:45:4
at Compiler.compile (/usr/local/lib/node_modules/blade/lib/compiler.js:185:2)
at compile (/usr/local/lib/node_modules/blade/lib/blade.js:41:12)
at Object.compileFile (/usr/local/lib/node_modules/blade/lib/blade.js:66:3)
at Object.runtime.loadTemplate (/usr/local/lib/node_modules/blade/lib/runtime.js:269:23)
at Object.runtime.include (/usr/local/lib/node_modules/blade/lib/runtime.js:320:22)
at eval (eval at <anonymous> (/usr/local/lib/node_modules/blade/lib/compiler.js:138:23))
Your application is crashing. Waiting for file change.
信息刀片
.player-name.large= player.name
客户端.js
if(Meteor.is_client) {
Template.info.player = function(){
var data = Session.get( 'data' );
return data.player;
};
}
EDIT:现在正文模板中允许使用助手。
You cannot use helpers or certain global variables in head or body templates. You can't even use them in templates that are included by head or body templates.
查看这些链接以获取更多信息:
https://github.com/bminer/node-blade/issues/98 https://github.com/bminer/node-blade/issues/98
- https://github.com/bminer/node-blade/wiki/Using-Blade-with-Meteor https://github.com/bminer/node-blade/wiki/Using-Blade-with-Meteor
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)