npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

watermark-unique

v1.0.3

Published

前端水印

Downloads

8

Readme

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',
    }
   }
)

| key | value | default value | |:--|:--|:--| | wWidth | A number that the width of the watermark block.(水印块宽度) | 240 | | wHeight | A number that the height of the watermark block.(水印块高度) | 140 | | wTop | A string that the distance between the watermark mask layer and the top of the page.(水印遮罩层距离页面顶部的距离) | '0px' | | wLeft | A string that the distance between the watermark mask layer and the left of the page.(水印遮罩层距离页面左边的距离) | '0px' | | wRotateDeg | A string that specifies SameSite attribute that restricts cookie access based on the site context.(水印角度) | 25 | | wFontSize | A string that the watermark font size(水印的字体大小,与下面的wFont任选一个设置) | '1.2rem' | | wFont | A string that the watermark font size, font style(水印的字体大小、字体风格) | '1.2rem Vedana' | | wColor | A string that the watermark font color(水印字体颜色) | '#666' | | wOpacity | A string that the watermark mask layer transparency(水印遮罩层透明度) | '0.2' | | wZIndex | A string that the zIndex of watermark mask(水印遮罩层层级) | 10000 |

Watermark.removeWatermark

清除水印

Watermark.removeWatermark()