gpt4 book ai didi

javascript - Rails 3 - 未找到一些必需的 JS

转载 作者:行者123 更新时间:2023-11-28 09:12:14 25 4
gpt4 key购买 nike

我将 Rails 2.2.2 站点移至 Rails 3,并一直在修复它。我现在进入网站的 JS 部分,当我点击包含 JS 的页面时,我看到以下内容:

enter image description here

这可能是级联问题吗? -controls.js 在effects.js 之前加载我认为Rails 会以某种方式在幕后处理这个问题?

这是 JS 加载的顺序:

Started GET "/assets/jquery.js?body=1"
Served asset /jquery.js - 200 OK (0ms)


Started GET "/assets/jquery-ui.js?body=1"
Served asset /jquery-ui.js - 200 OK (0ms)


Started GET "/assets/jquery.alerts.js?body=1"
Served asset /jquery.alerts.js - 200 OK (0ms)


Started GET "/assets/jquery_ujs.js?body=1"
Served asset /jquery_ujs.js - 200 OK (0ms)


Started GET "/assets/admin.js?body=1"
Served asset /admin.js - 200 OK (0ms)


Started GET "/assets/controls.js?body=1"
Served asset /controls.js - 200 OK (0ms)


Started GET "/assets/dragdrop.js?body=1"
Served asset /dragdrop.js - 200 OK (0ms)


Started GET "/assets/effects.js?body=1"
Served asset /effects.js - 200 OK (0ms)


Started GET "/assets/jquery.validate.min.js?body=1"
Served asset /jquery.validate.min.js - 200 OK (0ms)


Started GET "/assets/prototype.js?body=1"
Served asset /prototype.js - 200 OK (0ms)


Started GET "/assets/application.js?body=1"
Served asset /application.js - 200 OK (3ms)


Started GET "/assets/jquery-ui.css?body=1"
Served asset /jquery-ui.css - 200 OK (0ms)


Started GET "/assets/jquery.alerts.css?body=1"
Served asset /jquery.alerts.css - 200 OK (0ms)


Started GET "/assets/default.css?body=1"
Served asset /default.css - 200 OK (0ms)


Started GET "/assets/jquery.js?body=1"
Served asset /jquery.js - 200 OK (0ms)


Started GET "/assets/jquery-ui.js?body=1"
Served asset /jquery-ui.js - 200 OK (0ms)

文件application.js如下所示:

//= require jquery
//= require jquery_ujs
//= require_tree .

我该如何解决这个问题?

非常感谢!

/app/assets/javascript

enter image description here

最佳答案

您需要在application.js中指定加载顺序:

//= require jquery
//= require jquery_ujs
//= require prototype/prototype
//= require prototype/effects
//= require prototype/dragdrop
//= require prototype/controls
//= require_tree .

关于javascript - Rails 3 - 未找到一些必需的 JS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16170764/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com