控制台浏览器中的错误:未捕获的TypeError:$(...)。 AaDropdownMenu不是函数

时间:2018-09-18 15:04:04

标签: javascript ruby-on-rails

我有一个使用Active_Admin和其他插件的导轨项目,在浏览器控制台中出现此错误。我该如何解决?

Uncaught TypeError: $(...).aaDropdownMenu is not a function
    at HTMLDocument.onDOMReady (dropdown-menu.self-5794b6ca26364ce522cb47a8ef050870fda0b886cfeef69ec27ef116900f1984.js?body=1:121)
    at HTMLDocument.dispatch (jquery3.self-5af507e253c37e9c9dcf65064fc3f93795e6e28012780579975a4d709f4074ad.js?body=1:5184)
    at HTMLDocument.elemData.handle (jquery3.self-5af507e253c37e9c9dcf65064fc3f93795e6e28012780579975a4d709f4074ad.js?body=1:4992)
    at Object.e.dispatch (turbolinks.self-569ee74eaa15c1e2019317ff770b8769b1ec033a0f572a485f64c82ddc8f989e.js?body=1:6)
    at r.notifyApplicationAfterPageLoad (turbolinks.self-569ee74eaa15c1e2019317ff770b8769b1ec033a0f572a485f64c82ddc8f989e.js?body=1:7)
    at r.pageLoaded (turbolinks.self-569ee74eaa15c1e2019317ff770b8769b1ec033a0f572a485f64c82ddc8f989e.js?body=1:7)
    at turbolinks.self-569ee74eaa15c1e2019317ff770b8769b1ec033a0f572a485f64c82ddc8f989e.js?body=1:6

application.js

//= require rails-ujs
//= require activestorage
//= require jquery
//= require turbolinks
//= require popper
//= require jquery.slick
//= require_tree .

activ_admin.js.coffe

#= require active_admin/base

和控制台

$.widget.bridge('aaDropdownMenu', ActiveAdmin.DropdownMenu);

onDOMReady = function() {
  return $('.dropdown_menu').aaDropdownMenu();     // Uncaught TypeError: $(...).aaDropdownMenu is not a function
};

1 个答案:

答案 0 :(得分:0)

我有完全相同的错误。 您应该在application.js中更改顺序jquery应该放在首位(这是一个非常重要的库)。我还更改了jQuery库的版本。

//= require jquery3
//= require rails-ujs
//= require activestorage
//= require turbolinks 
//= require popper
//= require jquery.slick
//= require_tree .