Animating views before destruction in Emberjs

前端 未结 3 859
走了就别回头了
走了就别回头了 2021-01-12 22:53

There is currently no way to delay view destruction in Ember. This presents a problem when you want to animate the view before destroying it.

So, I currently have th

3条回答
  •  佛祖请我去吃肉
    2021-01-12 23:49

    This is just an spontaneous idea from my side:

    This is the implementation of destroyElement in Ember.View (Link to Source):

     destroyElement: function() {
        return this.currentState.destroyElement(this);
      },
    

    You could try to override this method to do your animation:

    destroyElement: function() {
        var completeCallback = function(){
            return this.currentState.destroyElement(this);
        }
        this.$().fadeOut(completeCallback); //or whatever animation
    },
    

提交回复
热议问题