简体   繁体   English

material-ui 滑块我如何使用激活的(css api)来隐藏阴影

[英]material-ui slider how can i use activated (css api) to hide the shadows

i wang to know to how can i use activated to change the style of thumb and hide the shadows of thumb我想知道如何使用激活来改变拇指的风格并隐藏拇指的阴影

here is attribute description of the official website activated ---- Class applied to the track and thumb elements to trigger JSS nested styles if activated.这里是官网激活的属性描述----应用到track和thumb元素的类,如果激活则触发JSS嵌套样式。

here is my code这是我的代码

    const style={
         thumb:{
    bottom:15,
    '&$focused, &:hover':{
    boxShadow: `0px 0px 0px 0px`,
    }, 
  },activated:{
    boxShadow: `0px 0px 0px 0px` 
  },      
}

... ...

<Slider
      value={value}
      aria-labelledby="slider-image"  
      onChange={this.handleChange}
      max='10'
      step='1'
      classes={{
        container: classes.slider,
        track:classes.track,
        thumb:classes.thumb,
        focused:classes.focused,
        trackBefore:classes.trackBefore,
        trackAfter:classes.trackAfter,
        activated:classes.activated
      }}
      thumb={
        <Thumb num={value}/>
      }
  ...

Answering your question: how can i use activated to change the style of thumb and hide the shadows of thumb?回答你的问题:我如何使用激活来改变拇指的风格并隐藏拇指的阴影?

  • You must create a theme, in this example i'm importing lensIcon, then i apply my theme:你必须创建一个主题,在这个例子中我导入了 lensIcon,然后我应用了我的主题:

     import LensIcon from "@material-ui/icons/LensOutlined"; import { createMuiTheme } from "@material-ui/core/styles"; const themeIcon = createMuiTheme({ shadows: Array(25).fill('none') }) <Slider value={value} aria-labelledby="slider-icon" onChange={this.handleChange} thumb={<LensIcon theme={themeIcon} />} />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM