Skip to content

Watermark 水印

在页面或组件上添加指定的图片或文字,可用于版权保护、品牌宣传等场景。

基础用法

将 WaterMark 组件放在页面中,可以通过content字段设置水印显示内容,通过widthheight设置单个水印的高度与宽度,展示一个全屏的水印。

html
<wui-watermark content="elegant-wui-uni" :width="130" :height="130"></wui-watermark>

图片水印

通过image字段设置网络图片地址或 Base64 图片,通过image-widthimage-height字段设置水印图片的宽高。 注意:钉钉小程序平台仅支持网络图片。

html
<wui-watermark image="https://isdm-public.oss-cn-hangzhou.aliyuncs.com/image/vue-logo.png" :image-width="38" :image-height="38"></wui-watermark>

局部水印

通过full-screen设置是否为全屏水印。

html
<wui-watermark content="elegant-wui-uni" :full-screen="false"></wui-watermark>

自定义层级和透明度

通过opacity设置透明度、z-index设置水印层级。

html
<wui-watermark content="elegant-wui-uni" :opacity="0.4"></wui-watermark>

Attributes

参数说明类型可选值默认值最低版本
content显示内容string-''-
image显示图片的地址,支持网络图片和 base64(钉钉小程序支持网络图片)string-''-
imageHeight图片高度number-100-
imageWidth图片宽度number-100-
gutterXX 轴间距,单位 pxnumber-0-
gutterYY 轴间距,单位 pxnumber-0-
widthcanvas 画布宽度,单位 pxnumber-100-
heightcanvas 画布高度,单位 pxnumber-100-
fullScreen是否为全屏水印boolean-true-
color水印字体颜色string-'#8c8c8c'-
size水印字体大小,单位 pxnumber-14-
fontStyle水印字体样式(仅微信、支付宝和 h5 支持)stringnormal / italic / oblique'normal'-
fontWeight水印字体的粗细(仅微信、支付宝和 h5 支持)stringnormal / bold / bolder'normal'-
fontFamily水印字体系列(仅微信、支付宝和 h5 支持)string-'PingFang SC'-
rotate水印旋转角度number--25-
zIndex自定义层级number-1100-
opacity自定义透明度,取值 0~1number-0.5-

源代码

文档
组件

Released under the MIT License.

Released under the MIT License.