h5页面-弹出黑色遮罩层实现
alertLayer() {
const div = document.createElement("div");
div.style.position = "fixed";
div.style.top = "0";
div.style.bottom = "0";
div.style.zIndex = "100001";
div.style.background = "rgba(0,0,0,0.64)";
div.style.width = "100%";
div.style.boxSizing = "border-box";
div.style.padding = "2vw 6vw 0 0";
const img = document.createElement("img");
img.style.width = "72%";
img.style.float = "right";
img.src =
"https://static.lib.com/product/kd-lib/download-notice.png";
div.appendChild(img);
document.body.appendChild(div);
}
src中上传的图片,如下所示: