gpt4 book ai didi

javascript - requirejs 计时问题 - 一些 bootstrap js 不工作

转载 作者:行者123 更新时间:2023-12-03 12:30:21 25 4
gpt4 key购买 nike

自从开始使用 requireJs 以来,我遇到了一个奇怪的问题。这个问题似乎只发生在一些可以展开以查看子菜单项的侧边栏菜单项上。 RequireJS 模块在最后调用,在

之前

body

标签和页面上的其他 JS 本身工作正常,只是这个侧边栏菜单不行。非常感谢您的帮助,因为我已经为此奋斗了好几天!

布局 View :

<body>
...Ouput ommited for brevity
<ul class="nav nav-list">
<li>
<a href="#" class="dropdown-toggle">
<i class="menu-icon fa fa-desktop"></i>
<span class="menu-text"> Devices </span>
<b class="arrow fa fa-angle-down"></b>
</a>

<b class="arrow"></b>

<ul class="submenu">
<li>
<a href="#" class="dropdown-toggle">
<i class="menu-icon fa fa-caret-right"></i>
CA Spectrum
<b class="arrow fa fa-angle-down"></b>
</a>

<b class="arrow"></b>
</li>
</ul>
</li>
</ul>
...Output ommited for brevity

@RenderSection("scripts", required: false)

</body>

The "dropdown-toggle" class is something that bootstrap.js uses to do the dropdown behavior.

具有呈现在布局 View 底部的脚本部分的 subview :

@section scripts {
<script data-main="/Scripts/dist/app" src="~/Scripts/dist/require.js"></script>
<script>
var ajaxUrl = '@Url.Content(url)';
require(['app'], function () {
require(['casnodes-downtime']);
});
</script>
}

app.js

requirejs.config({
baseUrl: "/Scripts/dist/",
paths: {
"requireLib": "./require",
"app": "./app",
"main": "./main",
"jquery": "./jquery-2.1.4",
"jqbsace": "./jqbsace",
"datatables": "./jquery.dataTables",
"moment": "./moment",
"momentTZ": "./moment-timezone",
"momentDF": "./moment-duration-format",
"datarangepicker": "./daterangepicker/daterangepicker",
"highstock": "./highstock",
"highmaps": "./highmaps",
"bootstrap": "./bootstrap",
"aceconcat": "./aceconcat",
"jstz": "./jstz-1.0.4.min",
"shared": "./controllers/shared1",
"usa": "./us-all",
// Controller modules
"casnodes-chronicnodes": "./controllers/casnodes/chronicnodes",
"casnodes-downtime": "./controllers/casnodes/downtime",
"casnodes-downnodes": "./controllers/casnodes/downnodes",
"casnodes-nodedowntime": "./controllers/casnodes/nodedowntime"
},
shim: {
"highstock": ["jquery"],
"jstz": {
exports: "jstz"
},
"bootstrap": ["jquery"],
"aceconcat": ["bootstrap"],
"momentDF": ["moment"],
"highmaps": ['jquery'],
"usa": ['jquery', 'highmaps']
}
});

requirejs(["main"]);

ma​​in.js

define([], function () {

});

casnodes-宕机模块

define(["jquery", "moment", "jstz", "momentDF", "momentTZ", "datatables", "highstock", "datarangepicker", "aceconcat"], function ($, moment) {
$(document).ready(function () {
...Output ommited for brevity
});
});

最佳答案

你应该使用其中之一

      require(['app','casnodes-downtime'], function () {

});

    require(, function () {
require('app');
require('casnodes-downtime');
});

不要混淆它们。

关于javascript - requirejs 计时问题 - 一些 bootstrap js 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34661391/

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