Skip to content

Watermark 水印

介绍

页面上添加特定的文字或图案,可用于防止信息盗用。

基础用法

html
<template>
  <nut-watermark content="水印内容" :z-index="1"></nut-watermark>

  <nut-watermark
    image="//img11.360buyimg.com/imagetools/jfs/t1/57345/6/20069/8019/62b995cdEd96fef03/51d3302dfeccd1d2.png"
    :image-width="60"
    :image-height="23"
    :z-index="1"
  ></nut-watermark>
</template>

局部用法

html
<template>
  <nut-watermark content="NutUI" :full-page="false" font-color="#fa2c19"></nut-watermark>
</template>

多行水印

content 属性传入 string 数组,展示的则是多行水印。

html
<template>
  <nut-watermark
    :content="['NutUI', 'Watermark']"
    :full-page="false"
    :gap-y="24"
    font-color="#fa2c19"
  ></nut-watermark>
</template>

API

Props

参数说明类型可选值默认值
content水印文字内容string / Array--
width水印的宽度number-120
height水印的高度number-64
rotate水印绘制时,旋转的角度number--22
image水印图片(优先级高于 contentstring--
image-width图片宽度number-120
image-height图片高度number-64
z-index水印元素的 z-indexnumber-2000
font-color水印文字颜色string-rgba(0, 0, 0, .15)
font-size文字大小string / number-14
font-weight文字字重string-normal
font-family文字字体string-PingFang SC
gap-x水印之间的水平间距number-24
gap-y水印之间的垂直间距number-48
full-page是否覆盖整个页面boolean-true

主题定制

样式变量

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

名称默认值
--nut-watermark-z-index2000

MIT Licensed