html - 我的输入应该是一个复选框,但呈现为一个文本输入框
问题描述
我正在尝试使用 CurrencyFormat 在 value 属性中呈现代码,但输入显示为带有文本类型而不是复选框的输入。正在渲染什么
<CurrencyFormat
renderText={(value) => (
<>
<p>
Subtotal ({basket?.length} items): <strong> {` ${value}`}</strong>
</p>
<small className="subtotal__gift">
<input type="checkbox"/> This order contains a gift
</small>
</>
)}
decimalScale={2}
value={0}
display={"text"}
thousandSeparator={true}
prefix={"$"}
/>
解决方案
应该:
displayType={"text"}
不是:
display={"text"}
示例:https ://codesandbox.io/s/inspiring-rgb-o2w94?file=/src/App.js:761-790
推荐阅读
- python - 接收电子邮件附件作为空白文件
- r - R错误:“write(txt2,file =(“C:/Users/User/Documents/html”)中的意外',',
- java - 有条件地添加 tools.jar
- google-apps-script - 用于生成每个用户每周发送的电子邮件数量报告的 Google Apps 脚本
- java - JPA:如何在双向 OneToMany 中多次映射实体
- php - 网络服务问题并将图像加载到我的目录
- hyperledger-fabric - 从哪里开始 Hyperledger Fabric 开发?
- java - 在命令行上运行模块会出错:找不到模块目标
- r - 数据表在闪亮的仪表板中不正确
- javascript - 如何使同一页面上的多个 div 在每个浏览器会话中仅出现一次。(Javascript代码)