1

I am having problems with server side rending using Riot.

In my handler, I pass my foo object into my bar tag with something very similar to this:

reply(riot.render(bar, { foo: foo }));

This is a copy of my simple bar tag:

<bar>
    <h1>TEST</h1>
    <h1>{ foo }</h1>

    this.foo = opts.foo
    console.log(this.foo)
</bar>

When I point my browser to the relevant path, 'TEST' is visible but foo is not. My console.log(foo) works just fine.

4

1 回答 1

0

这在类似的设置上对我有用

<bar>
    <h1>TEST</h1>
    <h1>{ opts.foo }</h1>
    console.log(opts.foo)
</bar>

我相信最好直接绑定到数据对象而不是将其设置为另一个局部变量

于 2015-08-24T16:45:21.410 回答