I'm getting an error in the console Uncaught TypeError: $ (…). AaDropdownMenu is not a function

时间:2018-09-19 08:27:54

标签: javascript ruby-on-rails

I have a project on rails that uses Active_Admin and other plug-ins, I get this error in the browser console. How do I fix this?

Error

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

and console cod

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

onDOMReady = function() {
  return $('.dropdown_menu').aaDropdownMenu();     
};

gemfile

gem 'rails', '~> 5.2.1'
gem 'activeadmin'
gem 'devise'
gem 'pg', '>= 0.18', '< 2.0'
gem 'puma', '~> 3.11'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'dotenv-rails'

gem 'coffee-rails', '~> 4.2'
gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.5'
gem 'bootstrap', '~> 4.1.3'
gem 'jquery-rails'

gem 'bootsnap', '~> 1.3', '>= 1.3.1'
gem 'font-awesome-rails', '~> 4.7', '>= 4.7.0.2'
gem "jquery-slick-rails"

gem 'paperclip', '~> 5.0'

application.js

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

active_admin.js.coffe

#= require active_admin/base

0 个答案:

没有答案