How to modify the style of the el-select component provided by elementUI There are many solutions to this problem on the Internet: 1. Find the class name of the drop-down box and write a However, the above method does not hit the point. Overriding the global style is definitely not user-friendly, and modifying the style and adding classes do not work either. So, I looked at the style of the drop-down box. It was not in Then I went to the official website to see if there is a property to control it, and sure enough, there is such a person The default value is HTML <el-select :popper-append-to-body="false" v-model="taskType" placeholder="Please select" size="mini" class="select-style" popper-class="select-popper" > <el-option v-for="(item,index) in taskTypes" :key="index" :value="item.value" :label="item.label" ></el-option> </el-select> The code structure is as follows: In fact, this only changes the style inside the drop-down box. The style of the input box also needs to be modified by modifying the CSS .select-style { width: 3rem; margin-right: 0.36rem; /deep/.el-input__inner { border-top-left-radius: 0; border-bottom-left-radius: 0; border: 1px solid #a1a3ad; border-left-width: 0; background-color: rgba(0, 0, 0, 0.8); font-family: PingFangSC-Regular; font-size: 0.28rem; color: rgba(255, 255, 255, 0.6); } } Finally, attach the style of /deep/.select-popper { background-color: $item-bg-color; border-radius: 0.08rem; border: solid 0.02rem #1c395d; font-family: PingFangSC-Regular; .el-select-dropdown__item.selected { font-family: PingFangSC-Regular; font-size: 0.28rem; color: rgba(74, 141, 253, 1); } li { color: #fff; background: transparent; color: #fff; font-size: 0.28rem; } .el-select-dropdown__item:hover, .el-select-dropdown__item.hover { background-color: rgba(110, 147, 206, 0.2); margin-right: 1px; } .popper__arrow::after { border-bottom-color: $item-bg-color; } .popper__arrow { border-bottom-color: $item-bg-color; } .el-select-dropdown__empty { padding: 0.2rem; font-size: 0.28rem; } } Summarize Key point: The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. |
<<: Professional and non-professional web design
>>: JavaScript Basics: Immediate Execution Function
Process 1: with return value: drop procedure if e...
There are three date types in MySQL: date(year-mo...
This article shares the specific code for JavaScr...
Postfix is a free and open source MTA (Mail Tra...
<!--[if IE 6]> Only IE6 can recognize <![...
Table of contents 1. Effect 2. Main code 1. Effec...
The functions of the three attributes flex-grow, ...
Problem/failure/scenario/requirement The hard dis...
This article introduces the CSS Sticky Footer imp...
register The front-end uses axios in vue to pass ...
Table of contents 1. Environment Introduction 2. ...
Table of contents Preface 1. Parent component pas...
When Mysql occupies too much CPU, where should we...
This article shares the specific code of vue+swip...
1. Introduction The topic of whether to use forei...