有没有办法传入自定义类或id命名空间而不是默认的ember?
示例:转过来
<body class="ember-application">
<div class="ember-view"></div>
</body>
进入:
<body class="myapp-application">
<div class="myapp-view"></div>
</body>
答案 0 :(得分:12)
您可以传入自定义ID ,而不是默认的“ember- [numview]”。
只需设置elementId
类
Ember.View
字段即可
var mainView = Ember.View.create({
tagName: "section",
elementId: "main"
})
将生成:
<section id="main" class="ember-view">
</section>
要删除/修改默认的className“ember-view”,您需要在View类的PrototypeMixin上查找并编辑classNames字段...
Em.View.PrototypeMixin.mixins[2].properties.classNames = []
var mainView = Ember.View.create({
tagName: "section",
elementId: "main"
})
将生成:
<section id="main">
</section>
不知道副作用......
答案 1 :(得分:3)
没有
“ember-application”在Ember.EventDispatcher#setup中是硬编码的,而“ember-view”同样是Ember.View上classNames属性中的静态字符串。因为'classNames'是一个连接属性(这意味着子类组合它们的值而不是替换它们),所以可以将'myapp-view'添加到classNames数组中,但是不能从超类中删除(容易)值。 / p>