mirror of
https://gitee.com/dromara/go-view.git
synced 2025-04-06 03:58:04 +08:00
fix: 尝试解决背景图片无法截图的问题
This commit is contained in:
parent
36b1f37f3f
commit
68c68e96b1
@ -154,7 +154,9 @@ export const canvasCut = (html: HTMLElement | null, callback?: Function) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
html2canvas(html, {
|
html2canvas(html, {
|
||||||
backgroundColor: null
|
backgroundColor: null,
|
||||||
|
allowTaint: true,
|
||||||
|
useCORS: true
|
||||||
}).then((canvas: HTMLCanvasElement) => {
|
}).then((canvas: HTMLCanvasElement) => {
|
||||||
window['$message'].success('导出成功!')
|
window['$message'].success('导出成功!')
|
||||||
downloadByA(canvas.toDataURL(), undefined, 'png')
|
downloadByA(canvas.toDataURL(), undefined, 'png')
|
||||||
|
@ -179,7 +179,9 @@ export const useSync = () => {
|
|||||||
const range = document.querySelector('.go-edit-range') as HTMLElement
|
const range = document.querySelector('.go-edit-range') as HTMLElement
|
||||||
// 生成图片
|
// 生成图片
|
||||||
const canvasImage: HTMLCanvasElement = await html2canvas(range, {
|
const canvasImage: HTMLCanvasElement = await html2canvas(range, {
|
||||||
backgroundColor: null
|
backgroundColor: null,
|
||||||
|
allowTaint: true,
|
||||||
|
useCORS: true
|
||||||
})
|
})
|
||||||
|
|
||||||
// 上传预览图
|
// 上传预览图
|
||||||
|
Loading…
x
Reference in New Issue
Block a user