javascript - 更改样式(颜色)线性进度条/材质 UI/Reactjs
问题描述
<LinearProgress style={{barColorPrimary: "red"}}" value={Number(campanha.Percentual)} />
如何更改栏的 barColorPrimary?我需要使用代码中的样式。
解决方案
我喜欢使用 withStyles() 高阶组件来注入自定义样式。
在此处查看 LinearProgress 的示例:https ://codesandbox.io/s/material-demo-forked-kwvb1?file=/demo.tsx (我们为条形颜色覆盖 barColorPrimary,为背景覆盖 colorPrimary)。
有关在 Material UI 中自定义组件的更多信息,请参见:https ://material-ui.com/customization/components/
推荐阅读
- python - 为什么找不到带有熊猫的csv文件?
- windows-task-scheduler - Win 10 任务计划程序不断禁用任务
- flutter - Flutter: AudioPlayers how to stop multiple sounds at once?
- javascript - When the datepicker is initialized in javascript, why is the html page scrolled up?
- mysql - Why doesn't leftJoin Knex query work and gives me an error?
- javascript - highlight.js: CSS styling absent after setting innerHTML
- php - How to get all users with all their roles in a many to many relation based sql query?
- swift - 从一个属性中按字母顺序排列核心数据实体列表 - SwiftUI
- java - Restrict the number of occurrence of . (dot) to 1 in following regular expression
- java - 如何在 Tomcat / Eclipse 中仅部署我的静态内容?