Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何在 Ember 中创建使用纯 'ol HTML 而不是车把模板的视图?我正在使用一个名为 Rickshaw 的图形库,我希望能够调用它的“渲染”函数,该函数绘制到屏幕上,但我无法在车把模板中执行 javascript。
你可以尝试这样的事情:
App.GraphView = Ember.View.extend({ didInsertElement: function () { var graph = new Rickshaw.Graph({ element: this.$().get(0), series: [] // DATA }): graph.render(); } });
didInsertElement一旦视图被插入到 DOM 中就会被调用,通过调用this.$().get(0)你可以获得它的基本 DOM 元素。
didInsertElement
this.$().get(0)