以warning为例,

想更改其默认样式

我们可以通过chrome的审查,看看el-button--warning有那些样式,然把其样式复制出来,更改为自己想要的

稍微动手尝试下就可以发现只要改3个地方就可以了

1.是页面加载后的样式

2.是鼠标悬停样式

3.是点击按钮之后的样式

代码如下

    /* 更改element-UI按钮样式 */
  .el-button--warning {
    color: #fff;
    background-color: #FC813B;
    border-color: #FC813B;
  }
  .el-button--warning:hover{
    background-color: #EF9E6F;
    border-color: #EF9E6F;  
  }
  .el-button--warning:focus{
    background-color: #EF9E6F;
    border-color: #EF9E6F;  
  }

 不过我觉得最好的办法是自己封装个按钮组件,我这里是偷懒写法

相关文章:

  • 2021-04-25
  • 2021-07-23
  • 2022-12-23
  • 2022-01-08
  • 2022-01-08
  • 2022-01-28
  • 2021-12-28
  • 2021-04-01
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-19
  • 2021-12-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案