我在一个简单的Ember测试应用程序中使用ember-bootstrap的Navbar示例代码:
{{#bs-navbar as |navbar|}}
<div class="navbar-header">
{{navbar.toggle}}
<a class="navbar-brand" href="#">Brand</a>
</div>
{{#navbar.content}}
{{#navbar.nav as |nav|}}
{{#nav.item}}
{{#nav.link-to "home"}}Home{{/nav.link-to}}
{{/nav.item}}
{{#nav.item}}
{{#nav.link-to "navbars"}}Navbars{{/nav.link-to}}
{{/nav.item}}
{{/navbar.nav}}
{{/navbar.content}}
{{/bs-navbar}}然而,我有一些奇怪的结果;导航栏在我的页面中显示了12次。无论它的价值是什么,切换按钮也不会做任何事情-但这可能与肚脐出现12次的原因有关。见以下截图:

下面是我建立这个项目所采取的步骤:
ember new bootstrap-test/bootstrap-test:ember install ember-bootstrapember g ember-bootstrap --bootstrap-version=4
下面是我的ember-cli-build.js文件的内容:
/* eslint-env node */
'use strict';
const EmberApp = require('ember-cli/lib/broccoli/ember-app');
module.exports = function(defaults) {
let app = new EmberApp(defaults, {
'ember-bootstrap': {
'bootstrapVersion': 4,
'importBootstrapFont': false,
'importBootstrapCSS': false
}
});
// Use `app.import` to add additional libraries to the generated
// output files.
//
// If you need to use different assets in different
// environments, specify an object as the first parameter. That
// object's keys should be the environment name and the values
// should be the asset to use in that environment.
//
// If the library that you are including contains AMD or ES6
// modules that you would like to import into your application
// please specify an object with the list of modules as keys
// along with the exports of each module as its value.
return app.toTree();
};最后,我使用了ember-cli版本的2.14.2。任何帮助,以解决这一点,将是非常感谢。谢谢!
发布于 2017-08-20 18:37:31
这可能是由于didRender或didInsertElement钩子中的属性更新而导致的重呈现。如果是这样,那么您肯定会在控制台中得到断言错误。
如果控制台中没有报告更多的错误,我总是查找第一个错误。这对我的发展有很大帮助。
https://stackoverflow.com/questions/45785135
复制相似问题