小编Vin*_*ent的帖子

将参数传递给模板而不覆盖数据上下文

我想将一个新参数传递给模板,同时保留它的原始数据上下文.

  • 原始数据上下文:{message:"hello"} {{> myTemplate withIcon=True}}
  • 使用{withIcon:True}覆盖数据上下文

我的解决方案是将这样的数据包装起来.

<code>
{{> myTemplate originalData=this withIcon=True}}
</code>
Run Code Online (Sandbox Code Playgroud)

有更好的解决方案吗?

meteor

10
推荐指数
2
解决办法
952
查看次数

标签 统计

meteor ×1