js修改美化系统alert
作者:互联网
如图,把系统的alert修改为UI指定的样式
使用layui的layer覆盖window.alert方法
<style>
.layui-layer-title {
background-color: #fff;
border-color: #fff;
}
.layui-layer-dialog .layui-layer-content {
padding: 30px auto;
text-align: center;
}
.layui-layer-btn .layui-layer-btn0 {
width: 100px;
height: 36px;
text-align: center;
line-height: 36px;
background-color: #0156e2;
border-radius: 4px;
}
.layui-layer-btn .layui-layer-btn0:hover {
background-color: #0D65F6;
color: #fff
}
</style>
<script>
window.alert = alert;
function alert(msg) {
layui.use('layer', function () {
layer.open({
title: '提示'
, content: msg
});
});
}
</script>
标签:layer,color,layui,js,background,fff,alert,美化 来源: https://blog.csdn.net/immocha/article/details/123232273