当前位置:   article > 正文

vue3—elementPlus如何单独修改页面中的下拉框样式_vue3 下拉框下拉选项样式的修改

vue3 下拉框下拉选项样式的修改

vue3中只能去修改popper-class这个属性去修改 (自己想要的样式)重点 :样式修改不能写在scoped中,可以单独开个style

  popper-class="blueBack"(blueBack为自定义class名)

  1. <el-select popper-class="blueBack">
  2. <el-option />
  3. </el-select>

 单独写的css 样式(不单独写不生效)

  1. <style lang="less">
  2. .el-popper.is-light.blueBack {
  3. background-color: #254277 !important;
  4. border: 1px solid #254277 !important;
  5. }
  6. .blueBack.el-popper[data-popper-placement^=bottom] .el-popper__arrow::before {
  7. background: #254277 !important;
  8. border: 1px solid #254277 !important;
  9. }
  10. .blueBack.el-popper[data-popper-placement^=top] .el-popper__arrow::before {
  11. background: #254277 !important;
  12. border: 1px solid #254277 !important;
  13. }
  14. .blueBack {
  15. .el-select-dropdown__item.hover,
  16. .el-select-dropdown__item:hover {
  17. background: #2A77C6 !important;
  18. }
  19. .el-select-dropdown__item {
  20. color: #B3BCCE !important;
  21. }
  22. .el-select-dropdown__item.selected {
  23. background: #2A77C6 !important;
  24. }
  25. }

  修改下拉框的边框

  1. :deep(.el-input__wrapper) {
  2. background: linear-gradient(90deg, #0b3571, rgba(11, 53, 113, 0) 100%);
  3. box-shadow: 0 0 0 0 var(--el-input-border-color, var(--el-border-color)) inset;
  4. }
  5. :deep(.el-select:hover:not(.el-select--disabled) .el-input__wrapper) {
  6. box-shadow: 0 0 0 0 var(--el-select-input-focus-border-color) inset !important;
  7. }
  8. :deep(.el-select .el-input.is-focus .el-input__wrapper) {
  9. box-shadow: 0 0 0 0 var(--el-select-input-focus-border-color) inset !important;
  10. }
  11. :deep(.el-select:hover:not(.el-select--disabled) .el-input__wrapper) {
  12. background: #0b3571;
  13. }
  14. :deep(.el-select .el-input__wrapper) {
  15. background: #0b3571;
  16. }

效果展示 

 

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

闽ICP备14008679号