Mic*_*ton 9 css-transitions ember.js
根据我的理解,使用CSS转换的一种方法是使用 Ember.run.scheduleOnce('afterRender')
但是,对我而言,如果不添加超时,则无法正常工作.这是在Ember 1.0.0
View = Em.View.extend({
didInsertElement: function() {
Ember.run.scheduleOnce('afterRender', this, 'animateModalOpen');
},
animateModalOpen: function() {
// this does not work - modal gets styles from class "in" with no transition
$('.modal').addClass('in');
// this does work, the transition is fired
setTimeout(function() {
$('.modal').addClass('in');
}, 1);
}
},
});
Run Code Online (Sandbox Code Playgroud)
这是过去工作的东西,不再是,或者我错过了什么?
Ember.run.next 在这类事情上,我的工作非常顺利.
didInsertElement: function() {
Ember.run.next(this, this.animateModalOpen);
}
Run Code Online (Sandbox Code Playgroud)