当前位置:   article > 正文

element-plus (修改主题色 & button新增自定义属性修改样式)_var(--el-color-primary)

var(--el-color-primary)

styles -> element_theme.less

  1. :root {
  2. --el-color-primary: #F74023; // 主题色
  3. }
  4. // 分页左右箭头居中显示
  5. .el-pagination .btn-prev .el-icon, .el-pagination .btn-next .el-icon {
  6. margin: auto;
  7. }
  8. // 表格操作列 无数据时总有一条线问题
  9. .el-table__fixed-right {
  10. height: -webkit-fill-available;
  11. }
  12. /*滚动条样式*/
  13. ::-webkit-scrollbar {
  14. width: 12px;
  15. height: 12px;
  16. }
  17. ::-webkit-scrollbar-thumb {
  18. background: #ECECEC;
  19. }
  20. ::-webkit-scrollbar-track {
  21. background: #FAFAFA;
  22. border: none;
  23. }
  24. .el-form-item__label, .my_label {
  25. font-size: 14px;
  26. color: #606266;
  27. font-weight: 700 !important;
  28. }
  29. .el-button--text:hover, .el-button--text:focus, .el-button--text:active {
  30. color: #D7371E;
  31. }
  32. .el-button.is-plain:active, .el-button--default:hover, .el-button--default:focus, .el-button--default:active {
  33. background: var(--el-color-white);
  34. border-color: var(--el-color-primary);
  35. color: var(--el-color-primary);
  36. }
  37. // 查询按钮样式
  38. .el-button--primary, .el-button--primary:active{
  39. background: rgba(247, 64, 35, 1);
  40. border: none;
  41. color: #fff;
  42. }
  43. .el-button--primary:hover, .el-button--primary:focus {
  44. background: rgba(247, 64, 35, 0.8);
  45. border: none;
  46. color: #fff;
  47. }
  48. .el-button--primary.is-disabled, .el-button--primary.is-disabled:hover, .el-button--primary.is-disabled:focus, .el-button--primary.is-disabled:active {
  49. background: rgba(247, 64, 35, 0.5);
  50. border: none;
  51. color: #fff;
  52. }
  53. // 新增按钮样式
  54. .el-button--success.is-plain {
  55. background: rgba(247, 64, 35, 0.1);
  56. border-color: rgba(247, 64, 35, 0.4);
  57. color: rgba(247, 64, 35, 1);
  58. }
  59. .el-button--success.is-plain:hover, .el-button--success.is-plain:focus, .el-button--success.is-plain:active {
  60. background: rgba(247, 64, 35, 0.8);
  61. border-color: rgba(247, 64, 35, 0.8);
  62. color: #fff;
  63. }
  64. .el-button--success.is-plain.is-disabled, .el-button--success.is-plain.is-disabled:hover, .el-button--success.is-plain.is-disabled:focus, .el-button--success.is-plain.is-disabled:active {
  65. background: rgba(247, 64, 35, 0.1);
  66. border-color: rgba(247, 64, 35, 0.4);
  67. color: rgba(247, 64, 35, 1);
  68. opacity: 0.5;
  69. }
  70. // 蓝色调文件上传导入类 button-style-origin 文件下载导出类 type="warning" 删除按钮 size="mini" type="text"
  71. button[button-style-origin], button[button-style-origin]:hover, button[button-style-origin]:focus, button[button-style-origin]:active {
  72. background: #4A73FE;
  73. border-color: #4A73FE;
  74. color: #ffffff;
  75. }
  76. button[button-style-origin]:hover, button[button-style-origin]:focus, button[button-style-origin]:active {
  77. opacity: 0.8;
  78. }
  79. button[button-style-origin].is-disabled, button[button-style-origin].is-disabled:hover, button[button-style-origin].is-disabled:focus, button[button-style-origin].is-disabled:active {
  80. background: #4A73FE;
  81. border-color: #4A73FE;
  82. color: #ffffff;
  83. opacity: 0.5;
  84. }
  85. // 详情类按钮样式
  86. button[button-style-details] {
  87. background: #4A73FE;
  88. border-color: #4A73FE;
  89. color: #ffffff;
  90. padding: 0px 4px;
  91. min-height: 24px;
  92. }
  93. button[button-style-details]:hover, button[button-style-details]:focus, button[button-style-details]:active {
  94. background: #4A73FE;
  95. border-color: #4A73FE;
  96. color: #ffffff;
  97. opacity: 0.8;
  98. }
  99. button[button-style-details].is-disabled, button[button-style-details].is-disabled:hover, button[button-style-details].is-disabled:focus, button[button-style-details].is-disabled:active {
  100. background: #4A73FE;
  101. border-color: #4A73FE;
  102. color: #ffffff;
  103. opacity: 0.5;
  104. }
  105. // button-style-border-grey 白底灰边框黑字
  106. button[button-style-border-grey], button[button-style-border-grey]:hover, button[button-style-border-grey]:focus, button[button-style-border-grey]:active {
  107. background: #ffffff;
  108. border-color: rgba(0, 0, 0, 0.15);
  109. color: rgba(0, 0, 0, 0.65);
  110. border-radius: 2px;
  111. padding: 0px 4px;
  112. min-height: 24px;
  113. }
  114. button[button-style-border-grey]:hover, button[button-style-border-grey]:focus, button[button-style-border-grey]:active {
  115. opacity: 0.8;
  116. border-color: rgba(247, 64, 35, 1);
  117. color: rgba(247, 64, 35, 1);
  118. }
  119. button[button-style-border-grey].is-disabled, button[button-style-border-grey].is-disabled:hover, button[button-style-border-grey].is-disabled:focus, button[button-style-border-grey].is-disabled:active {
  120. background: #ffffff;
  121. border-color: rgba(0, 0, 0, 0.15);
  122. color: rgba(0, 0, 0, 0.65);
  123. border-radius: 2px;
  124. padding: 0px 4px;
  125. opacity: 0.5;
  126. }
  127. // button-style-border-red 白底红边框红字
  128. button[button-style-border-red], button[button-style-border-red]:hover, button[button-style-border-red]:focus, button[button-style-border-red]:active {
  129. background: #ffffff;
  130. border-color: rgba(247, 64, 35, 0.4);
  131. color: #F74023;
  132. border-radius: 2px;
  133. padding: 0px 4px;
  134. min-height: 24px;
  135. }
  136. button[button-style-border-red]:hover, button[button-style-border-red]:focus, button[button-style-border-red]:active {
  137. opacity: 0.8;
  138. }
  139. button[button-style-border-red].is-disabled, button[button-style-border-red].is-disabled:hover, button[button-style-border-red].is-disabled:focus, button[button-style-border-red].is-disabled:active {
  140. background: #ffffff;
  141. border-color: rgba(247, 64, 35, 0.4);
  142. color: #F74023;
  143. border-radius: 2px;
  144. opacity: 0.5;
  145. }
  146. // button-style-block 黑底白字
  147. button[button-style-block], button[button-style-block]:hover, button[button-style-block]:focus, button[button-style-block]:active {
  148. background: #121926;
  149. border-color: #121926;
  150. color: #ffffff;
  151. padding: 0px 4px;
  152. min-height: 24px;
  153. }
  154. button[button-style-block]:hover, button[button-style-block]:focus, button[button-style-block]:active {
  155. opacity: 0.8;
  156. }
  157. button[button-style-block].is-disabled, button[button-style-block].is-disabled:hover, button[button-style-block].is-disabled:focus, button[button-style-block].is-disabled:active {
  158. background: #121926;
  159. border-color: #121926;
  160. color: #ffffff;
  161. opacity: 0.5;
  162. }
  163. // button-style-view 操作里的按钮 红底白字
  164. button[button-style-view], button[button-style-view]:hover, button[button-style-view]:focus, button[button-style-view]:active {
  165. background: #F74023;
  166. border: none;
  167. color: #ffffff;
  168. padding: 0px 4px;
  169. min-height: 24px;
  170. }
  171. button[button-style-view]:hover, button[button-style-view]:focus, button[button-style-view]:active {
  172. opacity: 0.8;
  173. }
  174. button[button-style-view].is-disabled, button[button-style-view].is-disabled:hover, button[button-style-view].is-disabled:focus, button[button-style-view].is-disabled:active {
  175. background: #F74023;
  176. border: none;
  177. color: #ffffff;
  178. padding: 0px 4px;
  179. min-height: 24px;
  180. opacity: 0.5;
  181. }
  182. // button-style-text-block 黑字
  183. button[button-style-text-block], button[button-style-text-block]:hover, button[button-style-text-block]:focus, button[button-style-text-block]:active {
  184. color: #666;
  185. }
  186. button[button-style-text-block]:hover, button[button-style-text-block]:focus, button[button-style-text-block]:active {
  187. color: #999;
  188. }
  189. button[button-style-text-block].is-disabled, button[button-style-text-block].is-disabled:hover, button[button-style-text-block].is-disabled:focus, button[button-style-text-block].is-disabled:active {
  190. color: #999;
  191. }

使用:

<el-button size="mini" button-style-view @click="toOrder(scope.row)">查看订单</el-button>

参考: https://segmentfault.com/q/1010000040393608?utm_source=sf-similar-question

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家小花儿/article/detail/332417?site
推荐阅读
相关标签
  

闽ICP备14008679号