el-popover修改样式
时间: 2023-08-07 07:01:53 浏览: 195
el-popover的样式可以通过设置全局样式或者使用popper-class属性来修改。在App.vue中添加以下样式可以修改el-popover的样式:
```css
.el-popover {
position: absolute;
background: rgba(22,38,94,1) !important;
min-width: 73%;
width: 100%;
border: 0px solid #EBEEF5;
padding: 12px;
z-index: 2000;
margin-right: 55px;
color: white;
line-height: 1.4;
text-align: justify;
font-size: 14px;
box-shadow: 0 2px 12px 0 rgba(0,0,0,.1);
word-break: break-all;
}
.el-popper\[x-placement^=top\] .popper__arrow::after {
bottom: -0.2px;
margin-left: -6px;
border-top-color: rgba(22,38,94,1) !important;
}
```
另外,你也可以在el-popover组件中使用popper-class属性来修改样式。例如:
```html
<el-popover width="300" trigger="hover" popper-class="popperOptions" placement="top-start">
<!-- 弹出框内容 -->
</el-popover>
```
然后在样式中定义popperOptions类来修改样式:
```css
.popperOptions\[x-placement^=left\] .popper__arrow::after {
border-left-color: #EA4E3D;
}
.popperOptions\[x-placement^=right\] .popper__arrow::after {
border-right-color: #EA4E3D;
}
.popperOptions\[x-placement^=bottom\] .popper__arrow::after {
border-bottom-color: #EA4E3D;
}
.popperOptions\[x-placement^=top\] .popper__arrow::after {
border-top-color: #EA4E3D;
}
.popperOptions {
background-color: #EA4E3D;
color: #FFFFFF;
font-size: 18px;
padding: 5px;
border: #EA4E3D;
}
```
这样就可以根据需要修改el-popover的样式了。
#### 引用[.reference_title]
- *1* [el-popover修改样式](https://blog.csdn.net/sinat_42888557/article/details/98631586)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [el-popover 样式修改](https://blog.csdn.net/weixin_44980864/article/details/119774065)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [element Popover 弹出框样式修改](https://blog.csdn.net/elephant_my/article/details/110791771)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文