2017-02-01 56 views
0

是否有可能從組件內部注入一個mixin?如何從組件內部注入mixin?

import mixinCreator from 'ember-mixin-....'; 

    export default Ember.Component.extend({ 

     didReceiveAttrs() { 

     var aMixin = mixinCreator(...); 

     this.reopen(aMixin); 

    } 

    }); 
+0

請參閱本http://emberjs.com/api/classes/Ember.Mixin.html – kumkanillam

回答

2

只需用混入延長部件...

export default Ember.Component.extend(mixinCreator, { ...