所以我几乎在这里列出了确切的问题:Using jquery in Ember-cli
但我已经按照上面线程中的建议完成了以下操作:
添加:
app.import('bower_components/jquery-ui/jquery-ui.js');
app.import('bower_components/jquery-ui/ui/tooltip.js');
改变
Ember.$(selector).tooltip();
到
this.$(selector).tooltip();
尽管安装了 UI 并执行了上述操作,Ember 仍未将工具提示功能识别为已定义。
错误:
Uncaught TypeError: undefined is not a function
有什么帮助吗?
最佳答案
一些事情。首先,jquery-ui.js
是整个 jQuery UI 库。所以,您已经在其中获得了 tooltip
。删除第二行。
如果您只想要工具提示,则需要分别导入core
、widget
和position
( reference ),然后是 tooltip
。
最后,您可能想要包含一个主题。默认的住在这里:
app.import('bower_components/jquery-ui/themes/smoothness/jquery-ui.min.css');
这样,将 this.$().tooltip()
粘贴到 View 的 didInsertElement
回调中,您就可以开始了。
关于javascript - 带有 Ember CLI 的 jQuery UI,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27024489/