简体   繁体   English

Navbar-Toogle Bootstrap 5 不工作(使用 Angular)

[英]Navbar-Toogle Bootstrap 5 not working (with Angular)

my console show me this error , it's about popper js .我的控制台向我显示了这个错误,它是关于 popper js 的。 this is the error , and i think because of that my toggle button is not working这是错误,我认为因为我的切换按钮不起作用

scripts.js:7 Uncaught SyntaxError: Unexpected token 'export' scripts.js:7 Uncaught SyntaxError: Unexpected token 'export'

export default Popper;导出默认波普尔;

and this is my scripts这是我的脚本

   "scripts": [
              "node_modules/jquery/dist/jquery.min.js",
              "node_modules/popper.js/dist/popper.min.js",
              "node_modules/bootstrap/dist/js/bootstrap.min.js"
            ]
          },
 <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.10.2/dist/umd/popper.min.js" integrity="sha384-7+zCNj/IqJ95wo16oMtfsKbZ9ccEh31eOz1HGyDuCQ6wgnyJNSYdrPa03rtR1zdB" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.min.js" integrity="sha384-QJHtvGhmr9XOIpI6YVutG+2QOK9T+ZnN4kzFN1RtK3zEFEIsxhlmWl5/YESvpZ13" crossorigin="anonymous"></script>

You should use the umd version of the script because it's browser compatible.您应该使用该脚本的umd版本,因为它与浏览器兼容。 In the scripts, array try to replace:在脚本中,数组尝试替换:

"node_modules/popper.js/dist/popper.min.js"

with:和:

"node_modules/popper.js/dist/umd/popper.min.js"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM