我尝试过"didInsertElement“,但似乎不起作用,标记不存在,然后jQuery插件代码执行得太快。
发布于 2012-05-16 10:48:32
你能提供你的问题的jsFiddle吗?另外,试着这样做:
didInsertElement: function() {
Ember.run.next(optionalContext, function() {
// Your code here
});
}这将在当前runloop的末尾运行您的代码,这将保证所有呈现和绑定都已执行。
但请提供一个jsFiddle,以便给出更准确的答案。
发布于 2012-05-18 05:04:03
确保在视图上使用内置的jQuery选择器- this.$() -即使元素还没有插入,它也会起作用。
didInsertElement: function() {
this.$().jQueryPlugin();
}https://stackoverflow.com/questions/10610606
复制相似问题