对于我与 React-Bootstrap 一起使用的所有组件,除了模态、警报等中内置的关闭按钮之外,所有样式都有效。示例如下。
\n警报组件 - 预期
\n\n我看到的警报组件
\n\n模态组件 - 预期
\n\n我看到的模态组件
\n\n我正在使用的构建在 React-Bootstrap 之上的 npm 包也发生了同样的事情,比如React-Bootstrap-Typeahead。
\n这些是我正在使用的依赖项:
\n"bootstrap": "^5.0.0-beta1",\n"popper.js": "^1.16.1",\n"react-bootstrap": "^1.4.0",\n"react-bootstrap-typeahead": "^5.1.4"\nRun Code Online (Sandbox Code Playgroud)\n我在我的文件中导入 Bootstrap CSS index.js:
"bootstrap": "^5.0.0-beta1",\n"popper.js": "^1.16.1",\n"react-bootstrap": "^1.4.0",\n"react-bootstrap-typeahead": "^5.1.4"\nRun Code Online (Sandbox Code Playgroud)\r\n我像这样在我的文件中导入 React-Bootstrap,除了关闭按钮之外,一切都正常工作。
\nimport { Modal, Button, Alert } from \'react-bootstrap\';\nRun Code Online (Sandbox Code Playgroud)\n不过,我不会在任何地方导入 Popper.js 或 Bootstrap.js。有谁知道可能出了什么问题?
\n下面是在 HTML DOM 中呈现的按钮以及正在应用的样式。奇怪的是,按钮上的类没有应用任何样式.close(并且 中也没有应用任何样式bootstrap.min.css …