将Bladejs与Meteor一起使用 [英] Using Bladejs with Meteor

查看:137
本文介绍了将Bladejs与Meteor一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近在我的流星上添加了node-blade智能软件包,并且静态内容显示良好.但是,我无法使用任何模板变量.在安装刀片服务器之前,模板变量可以与车把配合使用.有人知道我在做什么错吗?

I recently added the node-blade smart package to my meteor and have static content displaying fine. However, I'm not able to use any template variables. Before I installed blade, the template variables worked fine with handlebars. Does anybody know what I'm doing wrong?

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.

info.blade

.player-name.large= player.name

client.js

if(Meteor.is_client) {
    Template.info.player = function(){
        var data = Session.get( 'data' );
        return data.player;
    };
}

推荐答案

编辑:现在,在主体模板中允许使用帮助程序.

Helpers are now permitted in body templates.

您不能在head 或body 模板中使用助手或某些全局变量.您甚至不能在head 或body 模板所包含的模板中使用它们.

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.

查看这些链接以获取更多信息:

Checkout these links for more information:

这篇关于将Bladejs与Meteor一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆