Skip to content

Watermark ​

Add specified images or text to pages or components, which can be used for copyright protection, brand promotion, and other scenarios.

Component Types ​

Local Text Watermark ​

Specify watermark text via content, and use full-screen="false" to limit the watermark to a local container.

html
<view class="watermark-wrap">
	<wd-watermark :full-screen="false" content="wot-ui"></wd-watermark>
</view>

Local Image Watermark ​

Specify image address via image, and use image-width, image-height to control image size.

Note

DingTalk mini program only supports network images, does not support Base64 image watermarks.

html
<view class="watermark-wrap">
	<wd-watermark :full-screen="false" image="https://wot-ui.cn/logo.svg" :image-width="38" :image-height="38"></wd-watermark>
</view>

Local Multi-line Text Watermark ​

After increasing width and height, it can carry longer text content, suitable for multi-line display.

html
<view class="watermark-wrap">
	<wd-watermark :full-screen="false" :width="150" :height="150" content="Multi-line text watermark test automatic line break effect display, this is a very long text"></wd-watermark>
</view>

Special Styles ​

Full-screen Watermark ​

By default, the component will cover the entire page. Combined with layout, you can switch between grid layout and staggered layout, and also switch between text watermarks and image watermarks.

html
<wd-watermark content="wot-ui" :width="130" :height="140" layout="grid"></wd-watermark>

Custom Z-index and Opacity ​

Set opacity via opacity, and control watermark z-index via z-index.

html
<wd-watermark content="wot-ui" :opacity="0.4" :z-index="1200"></wd-watermark>

Watermark Attributes ​

ParameterDescriptionTypeDefault Value
contentWatermark text contentstring''
imageWatermark image address, supports network images and Base64 images, DingTalk mini program only supports network imagesstring''
image-heightImage heightnumber100
image-widthImage widthnumber100
gutter-xX-axis spacing, unit is pxnumber0
gutter-yY-axis spacing, unit is pxnumber0
widthSingle watermark canvas width, unit is pxnumber100
heightSingle watermark canvas height, unit is pxnumber100
full-screenWhether to cover the entire pagebooleantrue
colorWatermark text colorstring#C9CBD4
sizeWatermark text size, unit is pxnumber14
font-styleWatermark font style, only supported by WeChat, Alipay and H5, optional values are normal, italic, obliqueWatermarkFontStylenormal
font-weightWatermark font weight, only supported by WeChat, Alipay and H5string | numbernormal
font-familyWatermark font family, only supported by WeChat, Alipay and H5stringPingFang SC
rotateWatermark rotation anglenumber-25
z-indexWatermark z-indexnumber1100
opacityWatermark opacity, value range is 0 to 1number-
layoutWatermark layout, optional values are grid, staggeredWatermarkLayoutgrid
custom-styleCustom root node stylestring''
custom-classCustom root node style classstring''

主题定制 ​

CSS 变量 ​

组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 ConfigProvider 全局配置。

名称默认值描述
--wot-watermark-opacity$opacity-dimmer水印透明度

Source Code ​

Documentation
• Component

Released under the MIT License.

Released under the MIT License.