修改水印细节
This commit is contained in:
@@ -1,34 +1,18 @@
|
||||
let watermark = {}
|
||||
let setWatermark = (str) => {
|
||||
let id = '1.23452384164.123412415'
|
||||
|
||||
if (document.getElementById(id) !== null) {
|
||||
document.body.removeChild(document.getElementById(id))
|
||||
}
|
||||
|
||||
let can = document.createElement('canvas')
|
||||
can.width = 190
|
||||
can.height = 120
|
||||
|
||||
let cans = can.getContext('2d')
|
||||
cans.rotate(-30 * Math.PI / 180)
|
||||
cans.font = '15px Vedana'
|
||||
cans.font = '13px Vedana'
|
||||
cans.fillStyle = '#f4f4f4'
|
||||
cans.textAlign = 'left'
|
||||
cans.textBaseline = 'Middle'
|
||||
cans.fillText(str, can.width / 20, can.height)
|
||||
|
||||
let div = document.createElement('div')
|
||||
div.id = id
|
||||
div.style.pointerEvents = 'none'
|
||||
div.style.top = '-30px'
|
||||
div.style.left = '0px'
|
||||
div.style.position = 'absolute'
|
||||
div.style.zIndex = '1'
|
||||
div.style.width = '100%'
|
||||
div.style.height = '100%'
|
||||
div.style.background = 'url(' + can.toDataURL('image/png') + ') left top repeat'
|
||||
document.getElementsByClassName('main')[0].appendChild(div)
|
||||
cans.fillText(str, 10,120)
|
||||
document.getElementsByClassName('ant-card-body')[0].style.background = 'url(' + can.toDataURL('image/png') + ') left top repeat'
|
||||
return id
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user