# Watermark

A watermark: each unit tile is rendered offscreen on a canvas into a dataURL and then tiled as a background image over the protected content (pointer-events:none + selection-proof). Text and image modes; the H5 target adds MutationObserver tamper-proof self-healing. Tile tiling math and rendering decisions all consume the pure logic of @lh-ui/share/core/watermark.

Text watermark
<template>
  <div class="demo-col" style="gap: 18px">
    <LhWatermark content="lh-ui family" :font-size="16" :gap-x="120">
      <div class="watermark-demo-content">
        <p>Protected content: the watermark is layered over this area without blocking interaction.</p>
      </div>
    </LhWatermark>
    <LhWatermark :disabled="true" content="Disabled">
      <div class="watermark-demo-content"><p>disabled: no watermark layer is rendered.</p></div>
    </LhWatermark>
  </div>
</template>

# Image watermark and fullscreen

image takes precedence over content; fullscreen covers the viewport (fixed positioning):

<LhWatermark image="/logo.png" :opacity="0.2" fullscreen />

# Props

Prop Description Type Default
content Watermark text (multiple lines separated by \n); takes effect when image is not passed string —
image Watermark image URL; takes precedence over content when passed string —
opacity Overall opacity (0-1) number 0.15
rotate Unit tile rotation angle number -22
gapX Horizontal gap in px number 100
gapY Vertical gap in px (falls back to gapX when not passed) number —
fontSize Text font size in px (falls back to the watermark.fontSize token when not passed) number 14
fontColor Text color (falls back to the color.text.primary token when not passed) string —
zIndex Watermark layer z-index (falls back to zIndex.normal when not passed) number 100
fullscreen true covers the full screen; false is absolutely positioned within the nearest positioned parent boolean false
disabled Turn the watermark off (no watermark layer rendered) boolean false
sx sx shorthand layout props LhSxProps —

# Slots

Slot Description
default Protected content (the watermark is layered on top)

# Accessibility

The watermark layer is aria-hidden="true"; the root node has aria-label="Watermark".

Last Updated: 12/4/2026, 12:49:57 AM

Copyright © 2024-2026 FengMo WenXue