更换贺报下载的方法31

This commit is contained in:
xuxingjun
2024-12-31 14:38:03 +08:00
parent 92cb1c466a
commit 7973e6b342

View File

@@ -77,9 +77,6 @@ export default {
}, },
// 分享 // 分享
fenxiang() { fenxiang() {
if(this.$refs.xingdownLoad != this.$refs.xingdownLoad) {
return
}
// const element = document.getElementById('capture') // const element = document.getElementById('capture')
// const canvas = await html2canvas(element) // const canvas = await html2canvas(element)
html2canvas(this.$refs.xingdownLoad, { html2canvas(this.$refs.xingdownLoad, {
@@ -87,7 +84,9 @@ export default {
height: this.$refs.xingdownLoad.offsetHeight, height: this.$refs.xingdownLoad.offsetHeight,
backgroundColor: '#fff', backgroundColor: '#fff',
scale: 2, scale: 2,
dpi: 300 dpi: 300,
useCORS: true,
allowTaint: true,
}).then((canvas) => { }).then((canvas) => {
console.log('分享'); console.log('分享');
// 将 canvas 转换为 Blob // 将 canvas 转换为 Blob
@@ -105,9 +104,6 @@ export default {
}) })
}, 'image/png') }, 'image/png')
}) })
setTimeout(() => {
this.close()
}, 3000);
}, },
// 生成图片并下载 // 生成图片并下载
domToImage() { domToImage() {
@@ -125,7 +121,9 @@ export default {
height: domElement.offsetHeight, height: domElement.offsetHeight,
backgroundColor: '#fff', backgroundColor: '#fff',
scale: 1, scale: 1,
dpi: 300 dpi: 300,
useCORS: true,
allowTaint: true,
}); });
console.log('下载',canvas); console.log('下载',canvas);
// 将画布转换为 Blob并等待其完成 // 将画布转换为 Blob并等待其完成
@@ -167,8 +165,6 @@ export default {
close() { close() {
console.log(15434678); console.log(15434678);
// document.documentElement.removeChild(this.$refs.xingdownLoad)
// this.$refs.xingdownLoad.removeChild(this.$refs.xingdownLoad);
document.getElementById('capture').innerHTML = ''; document.getElementById('capture').innerHTML = '';
this.$emit('child-colse', '1') this.$emit('child-colse', '1')
}, },