2016-05-08 36 views
3

我試圖包裹Hootsuite Grid插件作爲灰燼成分:試圖總結一個jQuery插件作爲灰燼成分

import Ember from 'ember'; 

const { computed } = Ember; 

export default Ember.Component.extend({ 
    elementId: 'grid', 
    classNames: ['grid'], 
    tagName: 'ul', 
    didInsertElement() { 
    var self = this; 
    var options = { 
     lanes: 5, 
     direction: 'horizontal', 
     itemSelector: 'li[data-w]', 
     widthHeightRatio: 1, 
     onChange(changedItems) { 
     console.log(this); 
     } 
    }; 
    var gridList = this.$().gridList(options); 
    this.set('gridList', gridList); 
    }, 
    willDestroyElement() { 
    this.get('gridList').stop(); 
    } 
}); 

當我console.log(this);我可以看到,選項設置正確的父對象上,而不會傳遞到內部gridList對象

Properties in Chrome expor

儘管這些價值觀似乎要傳遞給測試小提琴子對象,我跟打:

https://jsfiddle.net/evmowy9k/

enter image description here

難道我做錯了什麼?

回答

0
Ember.run.next(this, function() { 
    var gridList = this.$().gridList(options); 
    this.set('gridList', gridList); 
}); 
+0

感謝您的努力,似乎是同樣的結果,雖然我害怕... –