【问题标题】:Jade dynamic 'template=content 'meaning翡翠动态'template=content'含义
【发布时间】:2016-10-14 17:23:19
【问题描述】:

我有一个来自 wekan 的玉模板 layout.jade 文件:

...
template(name="userFormsLayout")
  section.auth-layout
  //-h1.at-form-landing-logo
     img(src="{{pathFor '/wekan-logo.png'}}" alt="Wekan")
  section.auth-dialog
    +Template.dynamic(template=content)
    div.at-form-lang
...

我不明白这条线到底在做什么:

+Template.dynamic(template=content)

谁能给我解释一下,我对这个内容参考很好奇。

【问题讨论】:

  • 不是玉专家,但看起来像是一个包含,其中内容是包含html模板(或html模板的url)的变量
  • @fatman 我也这么认为,但我没有找到任何关于它的参考资料,所以我希望能在这个门户网站上获得更多关于这个问题的详细信息

标签: html meteor pug meteor-blaze


【解决方案1】:

它与jade语法无关,但与Blaze有关,请参阅相关文档here

使用示例:在使用路由器时,可以为每个路由定义content动态模板是什么模板名称。这是 FlowRouter 的示例(coffeescript 语法)

...
FlowRouter.route '/home',
    name: 'home'
    action: ->
        BlazeLayout.render 'layout',
            content: 'contentTemplateNameForHomeRoute'


FlowRouter.route '/user_profile',
    name: 'userProfile'
    action: ->
        BlazeLayout.render 'layout',
            content: 'contentTemplateNameForUserProfileRoute'
...

这可能是您的布局模板 (jadesyntax)

template(name='layout')
  +header
  +Template.dynamic template ='content'
...

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-08-07
    • 2013-05-19
    • 1970-01-01
    • 1970-01-01
    • 2014-04-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多