How do I customize the view element for the application.hbs template?

自古美人都是妖i 提交于 2019-12-04 13:37:56

create a file in the app/views directory that follows the naming conventions, application.js

import Ember from "ember";

export default Ember.View.extend({
  classNames: ['my-app-view']
  // this is the application view
});

Now confirm it works by inspecting your html:

<body class="ember-application">
  <div id="ember287" class="ember-view my-app-view">
    <h2 id="title">Welcome to Ember.js</h2>
  </div>
</body>

The Ember.View direct access is deprecated starting from version 2.x. What they did, is they have converted the Ember.View to an abstract class. Now you should use Ember.Component. As the short-cut, you could try something like this:

// app/views/application.js
import Ember from 'ember';

export default Ember.Component.extend({
  classNames: ['customClassName']
});
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!