// 下载npm包
npm install watermark-package -S

使用

         import watermark from "watermark-package";

          // 添加水印
          watermark.setWaterMark({
            w_texts: [data.userName, data.account],
            w_options: {
              w_width: 240,
              w_height: 140,
              w_top: '0px',
              w_left: '0px',
              w_rotateDeg: 25,
              w_font: '1.2rem Vedana',
              w_color: '#666',
              w_opacity: '0.2',
              w_zIndex: '100000',
            }
          })
          // 移除水印
          // watermark.removeWatermark()    

参考:https://blog.csdn.net/weixin_45032067/article/details/125055703?spm=1001.2101.3001.6650.7&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7ERate-7-125055703-blog-126570259.235%5Ev28%5Epc_relevant_default&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7ERate-7-125055703-blog-126570259.235%5Ev28%5Epc_relevant_default&utm_relevant_index=11