1
我在Ember應用程序中使用Cytoscape.js。我創建了一個圖形組件。我嘗試設置圖形樣式在組件的這樣的didInsertElement
功能:Cytoscape.js:風格不適用
this.get("cy").style()
.selector('node')
.css({
'width': '100px',
'height': '100px',
'border-color': 'gray',
'border-width': 3,
'border-opacity': 0.5
})
// unimportant code here
.selector('.faded')
.css({
'opacity': 0.0,
'text-opacity': 0
}).update();
當我訪問與在灰燼這個分量的路徑,不應用該樣式(但佈局和其他的東西都正常工作)。當我轉到另一條路線而不是後面時,神奇地出現了風格。
我在做什麼錯?如何將樣式應用於「初次加載」?
編輯:全部代碼可以發現here 車把代碼很簡單:
<div class="container content-section" id="graph-content">
<div class="centre" style="margin: 10px">
<!-- cytoscape graph -->
<div id="cy"></div>
</div>
您可以在ember-twiddle.com或emberjs.jsbin.com上設置演示,或者至少共享整個組件代碼? –
我添加了完整代碼的鏈接 – user3248821