[英]Google chart rendering in Ember.js
嘿,任何人都可以幫我解決這個問題。 我的看法是
<div id="sankey_multiple" style="width: 900px; height: 300px;"></div>
我的Component.js是
App.sankeyComponent = Ember.Component.extend({
needs: ['sankey'],
//navigation: Ember.computed.alias('controllers.navigation'),
isExpandedBookmarks: false,
didInsertElement: function() {
alert('insert');
}
});
但是didInsertElement函數無法正常工作,我無法准確地添加Google圖表腳本。
如果我將其添加到init函數中,則表示找不到容器。 所以我認為我們需要在didInsertElement之后添加。 但是它不起作用。 有人可以幫我嗎? 先感謝您。
Ember希望組件的命名約定具有大寫的字母,因此您應按以下步驟更改組件:
App.SankeyComponent = Ember.Component.extend({
needs: ['sankey'],
//navigation: Ember.computed.alias('controllers.navigation'),
isExpandedBookmarks: false,
didInsertElement: function() {
alert('insert');
}
});
另外,我不確定發布的視圖是嘗試使用組件的視圖還是組件本身的視圖。 這些應盡可能設置:
組件的定義:
<script type="text/x-handlebars" id="components/sankey-component ">
<!-- HTML for your component -->
</script>
在視圖中顯示組件,如下所示:
{{sankey-component}}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.