在 div 中包装 ember.js 正文内容

Wrapping ember.js body content in div

我试图用特殊的 class ('container').[=13= 将整个 SPA ember.js 页面的内容包装在 div 中]

我试过将车把移动到新的 div 中,但在输出页面上没有效果。

<div class="container">
   {{content-for 'body'}}
   {{content-for 'body-footer'}}
</div>

有什么想法吗?

您需要将 rootElement: '#container 添加到 app.js 文件。 rootElement 也需要是 id

像这样:

var App = Ember.Application.extend({
  modulePrefix: config.modulePrefix,
  podModulePrefix: config.podModulePrefix,
  Resolver: Resolver,
  rootElement: '#container',
});

在您的 index.html 文件中应该如下所示:

  <body>
    <div id="container"></div>
    {{content-for 'body'}}

    <script src="assets/vendor.js"></script>
    <script src="assets/YOUR_APP_NAME.js"></script>

    {{content-for 'body-footer'}}
  </body>

ember 应用程序将加载到容器 div 中。