是否可以将模板分组到流星中的命名空间?

cal*_*m85 5 meteor

是否有任何解决方案将模板分组到命名空间?

在测试一些示例代码时,我提出了问题,如何在巨大的模板中处理名称冲突.例如,假设我有一个包含三个部分的应用程序:

  • 用户(模板:登录,注销reset_password和设置)
  • 论坛(templates:new_post,list_posts,view_post,search)
  • 产品(模板:订单,查看,详细信息,搜索)

在产品和论坛中使用两种不同的搜索模板我会遇到麻烦.这可以通过将它们命名为forum_search和products_search来解决,但以命名空间方式进行操作会更自然.

而不是访问:

template.forum_search
template.products_search
Run Code Online (Sandbox Code Playgroud)

做这样的事情:

template.forum.search
template.products.search
Run Code Online (Sandbox Code Playgroud)

zor*_*lak 3

目前无法直接执行此操作,但它在 1.0 版本的 Meteor 路线图上:https://trello.com/card/template-and-helper-namespacing/508721606e02bb9d570016ae/17