博客
关于我
Vue中使用 watermark-dom 添加水印
阅读量:239 次
发布时间:2019-02-28

本文共 1367 字,大约阅读时间需要 4 分钟。

Watermark-dom?????????????????????????????????????????Vue??????????????

????

???????npm????????

npm install watermark-dom --savenpm install js-cookie --save

?????????????????????

?Vue?????

???Vue???????????????

  • ?????Cookie????
  • import watermark from 'watermark-dom';import Cookies from 'js-cookie';
    1. ?Vue????????main.js?App.vue?????mounted????????????
    2. ??????

      ??????????????????????????????

      export default {    name: 'App',    mounted() {        setTimeout(() => {            // ?????????????????            const username = Cookies.get('username');            if (username) {                const now = new Date();                const year = now.getFullYear();                const month = now.getMonth() + 1;                const day = now.getDate();                // ????????????????                const monthStr = month < 10 ? `0${month}` : `${month}`;                const dayStr = day < 10 ? `0${day}` : `${day}`;                const dateStr = `${year}-${monthStr}-${dayStr}`;                                // ????                watermark.load({                    watermark_txt: `${username},${dateStr}`                });            }        }, 1000);    }};

      ????

      • cookie???????????????cookie???????????
      • ?????????????????????month?day??????????
      • ?????????watermark.load???????????????????????????????

      ????????????Vue????????????????????cookie????????????????

    转载地址:http://xisp.baihongyu.com/

    你可能感兴趣的文章
    node防xss攻击插件
    查看>>
    noi 1996 登山
    查看>>
    noi 7827 质数的和与积
    查看>>
    NOIp2005 过河
    查看>>
    NOIP2011T1 数字反转
    查看>>
    NOIP2014 提高组 Day2——寻找道路
    查看>>
    NOIp模拟赛二十九
    查看>>
    Nokia5233手机和我装的几个symbian V5手机软件
    查看>>
    Non-final field ‘code‘ in enum StateEnum‘
    查看>>
    none 和 host 网络的适用场景 - 每天5分钟玩转 Docker 容器技术(31)
    查看>>
    None还可以是函数定义可选参数的一个默认值,设置成默认值时实参在调用该函数时可以不输入与None绑定的元素...
    查看>>
    NOPI读取Excel
    查看>>
    NoSQL&MongoDB
    查看>>
    NoSQL介绍
    查看>>
    Notepad ++ 安装与配置教程(非常详细)从零基础入门到精通,看完这一篇就够了
    查看>>
    Notepad++在线和离线安装JSON格式化插件
    查看>>
    notepad++最详情汇总
    查看>>
    notepad如何自动对齐_notepad++怎么自动排版
    查看>>
    Notification 使用详解(很全
    查看>>
    NotImplementedError: Cannot copy out of meta tensor; no data! Please use torch.nn.Module.to_empty()
    查看>>