如何修复这个Jquerybootstrap.bundle.min.js:6导航栏中出现的Bug?

2024-04-25 08:20:27 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用烧瓶引导创建我的网站,我是非常新的。 我在以下文件中遇到以下错误:

<script 
src="/static/vendor/bootstrap/js/bootstrap.bundle.min.js">
</script>

当我添加一个链接到我的导航栏如下

^{pr2}$

我在Chrome的开发人员控制台中遇到以下错误,文件无法正常工作:

Uncaught DOMException: Failed to execute 'querySelector' on 'Document': '/upload' is not a valid selector.
    at Object.getSelectorFromElement (http://127.0.0.1:5000/static/vendor/bootstrap/js/bootstrap.bundle.min.js:6:1377)
    at http://127.0.0.1:5000/static/vendor/bootstrap/js/bootstrap.bundle.min.js:6:67292
    at Array.map (<anonymous>)
    at n.t.refresh (http://127.0.0.1:5000/static/vendor/bootstrap/js/bootstrap.bundle.min.js:6:67266)
    at new n (http://127.0.0.1:5000/static/vendor/bootstrap/js/bootstrap.bundle.min.js:6:66907)
    at HTMLBodyElement.<anonymous> (http://127.0.0.1:5000/static/vendor/bootstrap/js/bootstrap.bundle.min.js:6:69792)
    at Function.each (http://127.0.0.1:5000/static/vendor/jquery/jquery.min.js:2:2573)
    at w.fn.init.each (http://127.0.0.1:5000/static/vendor/jquery/jquery.min.js:2:1240)
    at w.fn.init.n._jQueryInterface [as scrollspy] (http://127.0.0.1:5000/static/vendor/bootstrap/js/bootstrap.bundle.min.js:6:69744)
    at http://127.0.0.1:5000/static/js/agency.min.js:7:462

但是,当我没有向导航栏添加链接时,js文件就如预期的那样工作。在

请问我怎样才能克服这个错误?在

非常感谢

伊萨克


Tags: 文件http链接错误jsscriptstaticjquery
1条回答
网友
1楼 · 发布于 2024-04-25 08:20:27

如果您使用的是引导程序v4.2.1,这可能是一个在this question中讨论过的错误,也可能是github thread中讨论过的错误。在

在4.3.0发布之前,一个临时的解决方法可能是回到引导程序的早期版本,如果您只是在构建您的第一个站点,那么这个版本不会对您造成太大的影响。在

以下是4.1.3的CDN链接:

https://cdnjs.com/libraries/twitter-bootstrap/4.1.3

或者作为快速修复测试,只需将脚本标记替换为:

<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/js/bootstrap.bundle.min.js" integrity="sha256-E/V4cWE4qvAeO5MOhjtGtqDzPndRO1LBk8lJ/PR7CA4=" crossorigin="anonymous"></script>

相关问题 更多 >