Using mixins with Ember-cli?

前端 未结 2 810
一向
一向 2021-02-20 03:32

I have a mixin app/mixins/ui-listener.js which I\'m struggling to use with Ember-CLI. I\'m trying to use the mixin with the following syntax:

import         


        
2条回答
  •  不知归路
    2021-02-20 04:22

    I don't know how do you export your mixin but this should work:

    in mixins/ui-listener.js:

    import Ember from 'ember';
    
    export default Ember.Mixin.create({
     //some stuff
    });
    

    in components/my-component.js:

    import Ember from 'ember';
    import UIListenerMixin from '../mixins/ui-listener';
    
    export default Ember.Component.extend(UIListenerMixin, {
     // some stuff
    });
    

提交回复
热议问题