RiotJs如何做计算属性

时间:2016-01-14 02:10:35

标签: javascript riotjs

父母在传递属性

之前进行一些计算
<parent>
    <child src={compute(opts.src)}></child>
</parent>

它没有用。

http://plnkr.co/edit/MguuodHHRlVytnikQKZ7?p=preview

如何实现这一目标?

这是Web组件中非常基本的工具。

1 个答案:

答案 0 :(得分:2)

RiotJS将opts对象中的src属性转换为名为riotSrc的属性,因为在标记上使用src=""时不允许非法的服务器请求。

<child>
  <div>This is the original property: {opts.origin}</div>
  <div>This is the computed property: {opts.riotSrc}</div>
</child>
相关问题