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
When any project develops to a certain complexity...
question In the previous article about cross-doma...
Table of contents 1. Open the file Parameter Intr...
Install First you need to install Java and Scala,...
Without relying on JavaScript, pure CSS is used t...
MySQL's MyISAM and InnoDB engines both use B+...
Since I started working on Vulhub in 2017, I have...
Table of contents 1. Custom instructions 1. Regis...
Operation effectCode Implementation html <div ...
Method 1: Use CSS overflow omission to solve The ...
1.MySQL version [root@clq system]# mysql -v Welco...
Table of contents Preface Computed properties Int...
Table of contents Introduction Step 1 Step 2: Cre...
Table of contents Overview computed watch monitor...
Installing MySQL 5.7 from TAR.GZ on Mac OS X Comp...