我正在尝试在我的反应应用程序中使用bootstrap,但它给了我一个Error: Bootstrap's JavaScript requires jQuery.我已导入jquery并尝试过以下其他帖子:
import $ from 'jquery';
window.jQuery = $;
window.$ = $;
global.jQuery = $;
Run Code Online (Sandbox Code Playgroud)
但是,我仍然得到not defined错误.
解决这个问题的唯一方法就是放
src="https://code.jquery.com/jquery-3.2.1.min.js"
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin="anonymous"></script>
Run Code Online (Sandbox Code Playgroud)
进入index.html
有没有办法导出jquery或让bootstrap能够检测/读取它?
我打电话给我的引导程序
import bootstrap from 'bootstrap'
Run Code Online (Sandbox Code Playgroud)