
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>水印案例</title>
<style>
.box {
width: 500px;
height: 500px;
border: 1px solid #eee;
}
</style>
</head>
<body>
<div class="box">
<h1>hello world!</h1>
<p onclick="console.log('123')">我是水印保护的内容</p>
</div>
<div class="box"></div>
<script type="text/javascript">
/**
* 生成页面水印
* 支持:文字数组、base64 图片、HTMLImageElement、图片 URL
*/
function createWatermark({
texts = ["watermark", "By slongzhang"],
fontSize = 12,
opacity = 0.1,
angle = -20,
gapX = 125,
gapY = 100,
zIndex = 999,
id = "slongzhang@126.***",
mount = void 0
} = {
}) {
<