【问题标题】:Blaze layout always renders content after HTML structureBlaze 布局总是在 HTML 结构之后呈现内容
【发布时间】:2014-07-27 22:44:16
【问题描述】:

我创建了一个简单的 Bootstrap3 布局并想在流星中使用 blaze 模板,但我的模板中的内容总是在我的 HTML 结构之后呈现。

代码如下:

<head>
  <title>demo app</title>
</head>

<body>
  {{#Layout template="mainLayout"}}
    {{#contentFor region="main-content"}}
      This is the main content area
    {{/contentFor}}
  {{/Layout}}
</body>

<template name="home">
  {{welcomeText}}
</template>

<template name="mainLayout">
  <div class="container">
    <div class="row">
      <div class="col-sm-6">LOGO</div>
      <div class="col-sm-6">LOGIN BUTTONS</div>
    </div><!-- /header row -->
    <div class="row">
      <div class="col-sm-12">
        <!-- navigation -->
      </div>
    </div><!-- /nav row -->
    <div class="row">
      <div class="col-sm-12">
        {{> yield region="main-content"}}
      </div>
    </div><!-- /content row -->
  </div><!-- /container -->
</template>

JavaScript:

if (Meteor.isClient) {
  Template.home.welcomeText = function () {
    return "Welcome to my site.";
  };
}

当我运行它时,Bootstrap3 结构工作正常,但 welcomeText 呈现在容器下方。

【问题讨论】:

    标签: meteor meteor-blaze


    【解决方案1】:

    似乎我忽略了将 layoutTemplate 选项传递给我的 iron router 路由 - 现在它可以工作了。

    【讨论】:

      猜你喜欢
      • 2018-07-20
      • 1970-01-01
      • 1970-01-01
      • 2015-12-07
      • 1970-01-01
      • 2012-04-09
      • 1970-01-01
      • 2014-09-07
      • 2016-06-18
      相关资源
      最近更新 更多