当前位置:网站首页>问题3 — messageBox弹框,修改默认背景色
问题3 — messageBox弹框,修改默认背景色
2022-06-24 06:57:00 【酒鼎】
项目场景:
PC端开发,vue + elementUI,
源码部分
MessageBox.confirm(`${
message ? message : '是否继续?'}`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
})
问题描述
显示MessageBox 弹框,某种情况下,弹框背景色(遮罩层)是全黑色的。

原因分析:
可能是除了elementUI样式源码设置的背景颜色, 项目中某个地方也设置了弹框的背景色,2者重叠导致的。
解决方案:
- 找到弹框标签的class名字。具体步骤(以火狐浏览器为例):在页面上显示弹框,打开F12(控制台),选中弹框标签,复制选中元素的class名字(
el-message-box__wrapper); - 在公共组件、样式(建议放在公共文件内)文件中重新定义背景色,rgba值可以根据业务需求修改。
注意:必须附加在没有scoped的style标签中。
.el-message-box__wrapper{
background-color: rgba(0, 0, 0, 0.4);
}
- 如果需要定义背景色,又不能影响本页面其他样式,可以这样:
/* 页面其他样式 */
<style scoped> .pagination-wrap {
display: flex;
flex-direction: row-reverse;
}
</style>
/* 定义背景色的css */
<style> .el-message-box__wrapper{
background-color: rgba(0, 0, 0, 0.8);
}
</style>
实现效果:

边栏推荐
- Transformers pretrainedtokenizer class
- 1279_ Vsock installation failure resolution when VMware player installs VMware Tools
- Part 1: building OpenGL environment
- June 27, 2021: given a positive array arr, it represents the weight of several people
- GraphMAE----論文快速閱讀
- GraphMAE----论文快速阅读
- OC extension detects whether an app is installed on the mobile phone (source code)
- Oracle advanced SQL qualified query
- Online education fades
- Solution to the error of running NPM run eject
猜你喜欢

Future trends in automated testing

The first exposure of Alibaba cloud's native security panorama behind the only highest level in the whole domain

Ad-gcl:advantageous graph augmentation to improve graph contractual learning

2021-03-04 COMP9021第六节课笔记

Backup and restore SQL Server Databases locally

1-4metaploitable2 introduction

研究生英语期末考试复习

模型效果优化,试一下多种交叉验证的方法(系统实操)

首次曝光 唯一全域最高等级背后的阿里云云原生安全全景图

OC extension detects whether an app is installed on the mobile phone (source code)
随机推荐
Vulnhub靶机:BOREDHACKERBLOG: SOCIAL NETWORK
Auto usage example
2022年流动式起重机司机特种作业证考试题库及在线模拟考试
Simple refraction effect
Sql语句内运算问题
How to cancel the display of the return button at the uniapp uni app H5 end the autobackbutton does not take effect
Signature analysis of app x-zse-96 in a Q & a community
"Adobe international certification" about Adobe Photoshop, creating and modifying brush tutorials?
Introduction to software engineering - Chapter 2 - feasibility study
Swift 基礎 閉包/Block的使用(源碼)
基金的募集,交易与登记
3-list introduction
Swift 基础 闭包/Block的使用(源码)
LINQ 查询(2)
Swift 基础 Swift才有的特性
[run the script framework in Django and store the data in the database]
The monthly salary of two years after graduation is 36K. It's not difficult to say
Teach you how to use the reflect package to parse the structure of go - step 1: parameter type check
GraphMAE----论文快速阅读
直播回顾 | 云原生混部系统 Koordinator 架构详解(附完整PPT)