Watermark 水印

给页面某个区域加上文字或图片水印,适用于版权标识、防信息盗用。

何时使用

  • 需要为页面添加水印、防止信息泄露时。

基础用法

<script setup lang="ts">
import { Watermark } from "@reglow/reui";
</script>

<template>
  <Watermark content="Reglow">
    <div class="h-500px">内容区域</div>
  </Watermark>

  <!-- 多行水印 -->
  <Watermark :content="['Reglow', 'Happy Working']">
    <div class="h-500px" />
  </Watermark>

  <!-- 图片水印 -->
  <Watermark :width="130" :height="30" image="/logo.png">
    <div class="h-500px" />
  </Watermark>

  <!-- 自定义配置 -->
  <Watermark
    content="版权所有"
    :rotate="-30"
    :z-index="11"
    :gap="[200, 200]"
    :font="{ color: 'rgba(255,0,0,0.1)', fontSize: 24, fontWeight: 'bold' }"
  >
    <div class="h-500px" />
  </Watermark>
</template>

导入

import { Watermark } from "@reglow/reui";

Props

属性类型默认值说明
contentstring | string[]-水印文字
imagestring-水印图片地址(与 content 互斥)
width / heightnumber-水印宽高
rotatenumber-22旋转角度
zIndexnumber999层级
gap[number, number]-水印间距
font{ color?, fontSize?, fontWeight?, fontFamily? }-字体配置