[英]Why is Progressbar from react-bootstrap not working?
我正在使用 React 引导库中的 ProgressBar,我不知道为什么它不能正常工作
这是代码
<div>
<p>{selectedOption_1 ? <span><b>Your Choice</b> 👉 </span> : null} {props.location.state.option1}</p>
<p style={{fontSize: "small"}}>Votes: {props.location.state.optionOneVotes} </p>
<ProgressBar now={optionOnePercentage} animated variant="warning" striped label={`${optionOnePercentage}%`} />
</div>
即使我通过硬编码值,结果也是一样的
<ProgressBar now={60} />
<ProgressBar now='60' animated variant="warning" />
尝试传递一个常量值并测试它是否有效
问题可能是你试图从 props 或 state 传递optionOnePercentage
而你忘记写了
由于没有太多的代码问题可以在任何地方
尝试包括
import 'bootstrap/dist/css/bootstrap.min.css'
如果您使用npx create-react-app
创建了应用程序,则在index.js
文件中
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.