[英]rails 6 / webpacker tooltip and popover event listeners TypeError: $(…).tooltip is not a function
I'm getting the error TypeError: $(...).tooltip is not a function If I comment out tooltip only, then I get the same error for popover(is not a function) I had to remove the event listeners from application.js to stop the error I've seen suggested solutions that jquery-ui isn't installed but I found that requiring jquery-ui broke my app and so it's probably included in jquery-ujs and shouldn't be invoked on it's own but someone can advise me on that hopefully too我收到错误 TypeError: $(...).tooltip is not a function 如果我只注释掉工具提示,那么我会收到相同的弹出框错误(不是函数)我必须从应用程序中删除事件侦听器.js 来停止错误我已经看到建议的解决方案 jquery-ui 没有安装,但我发现需要 jquery-ui 破坏了我的应用程序,因此它可能包含在 jquery-ujs 中,不应该单独调用,但有人可以建议我对此也有希望
document.addEventListener("turbolinks:load", () => {
// $('[data-toggle="tooltip"]').tooltip()
// $('[data-toggle="popover"]').popover()
})
Here's my complete application.js这是我完整的 application.js
require("@rails/ujs").start()
require("turbolinks").start()
require("jquery")
require("js.cookie")
require("@rails/activestorage").start()
require("channels")
require("react")
require("react-dom")
require("bootstrap")
require.context('../images', true)
import "bootstrap"
import "blueimp-gallery"
import "../stylesheets/application"
document.addEventListener("turbolinks:load", () => {
// $('[data-toggle="tooltip"]').tooltip()
// $('[data-toggle="popover"]').popover()
})
import JQuery from 'jquery';
window.jQuery = $;
window.$ = $;
require("../stylesheets/application")
I solved this by using the rubygems jquery-ui-rails and while I was at it I threw in jquy-ui-themes.我通过使用 rubygems jquery-ui-rails 解决了这个问题,当我使用它时,我投入了 jquy-ui-themes。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.