1.0.3 • Published 1 year ago

watermark-unique v1.0.3

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

Watermark

前端添加水印

使用(Usage)

方式:安装npm包导入到需要使用的项目中去:

npm install watermark-unique

// import
import Watermark from 'watermark-unique'

导入后就可以调用下面的方法


Watermark.setWaterMark

使用时该方法时传入一个 options 配置对象, 配置对象主要有两个属性:wTextswOptionswTexts:水印文案的数组集合可设置多行文案。 wOptions:水印参数配置项,如字体大小、颜色、透明度,不传会有默认设置等

import Watermark from 'watermark-unique'

Watermark.setWaterMark(
   {
      wTexts: ['水印', 'watermark']
   }
)

options 配置对象还有另一个属性 wOptions水印参数配置: 用于设置水印的具体参数如宽度,大小等,各参数说明见下表

import Watermark from 'watermark-unique'

Watermark.setWaterMark(
   {
      wTexts: ['水印', 'watermark'],
      wOptions: {
        wWidth: 200,
        wHeight: 140,
        wTop: '0px',
        wLeft: '0px',
        wRotateDeg: 25,
        wFontSize: '1.2rem',
        wFont: '1.2rem Vedana',
        wColor: '#666',
        wOpacity: '0.2',
        wZIndex: '100000',
    }
   }
)
keyvaluedefault value
wWidthA number that the width of the watermark block.(水印块宽度)240
wHeightA number that the height of the watermark block.(水印块高度)140
wTopA string that the distance between the watermark mask layer and the top of the page.(水印遮罩层距离页面顶部的距离)'0px'
wLeftA string that the distance between the watermark mask layer and the left of the page.(水印遮罩层距离页面左边的距离)'0px'
wRotateDegA string that specifies SameSite attribute that restricts cookie access based on the site context.(水印角度)25
wFontSizeA string that the watermark font size(水印的字体大小,与下面的wFont任选一个设置)'1.2rem'
wFontA string that the watermark font size, font style(水印的字体大小、字体风格)'1.2rem Vedana'
wColorA string that the watermark font color(水印字体颜色)'#666'
wOpacityA string that the watermark mask layer transparency(水印遮罩层透明度)'0.2'
wZIndexA string that the zIndex of watermark mask(水印遮罩层层级)10000

Watermark.removeWatermark

清除水印

Watermark.removeWatermark()
1.0.3

1 year ago

1.0.2

1 year ago

1.0.0

1 year ago