更换贺报下载的方法16

This commit is contained in:
xuxingjun
2024-12-26 15:24:29 +08:00
parent 13739a7530
commit 1bece27866

View File

@@ -45,9 +45,6 @@ export default {
downLoadJin: false, downLoadJin: false,
} }
}, },
beforeCreate() {
this.$refs.xingdownLoad = null;
},
created() { created() {
// this.isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream; // this.isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
// if(this.isIOS) { // if(this.isIOS) {
@@ -59,7 +56,7 @@ export default {
this.getList() this.getList()
}, },
beforeDestroy(){ beforeDestroy(){
this.$refs.xingdownLoad = null; this.$refs.xingdownLoad.parentNode.removeChild(this.$refs.xingdownLoad);
}, },
methods: { methods: {
getList() { getList() {
@@ -134,12 +131,13 @@ export default {
scale: 1, scale: 1,
dpi: 300 dpi: 300
}); });
domElement = null
// 将画布转换为 Blob并等待其完成 // 将画布转换为 Blob并等待其完成
const blob = await new Promise((resolve, reject) => { const blob = await new Promise((resolve, reject) => {
canvas.toBlob(resolve, 'image/png'); canvas.toBlob(resolve, 'image/png');
console.log(3333); console.log(3333);
}); });
// let arr = false // let arr = false
// // 将 Blob 转换为 Base64 字符串,并等待其完成 // // 将 Blob 转换为 Base64 字符串,并等待其完成
// if(arr == false) { // if(arr == false) {
@@ -156,7 +154,6 @@ export default {
// 调用 base64Excel 函数,并等待其完成 // 调用 base64Excel 函数,并等待其完成
const res = await base64Excel({ base64Img: base64String }); const res = await base64Excel({ base64Img: base64String });
// 检查结果,并处理下载逻辑 // 检查结果,并处理下载逻辑
if (res.result === '0') { if (res.result === '0') {
console.log(5555); console.log(5555);
@@ -200,8 +197,9 @@ export default {
}, },
close() { close() {
this.$emit('child-colse', '1')
this.$refs.xingdownLoad.parentNode.removeChild(this.$refs.xingdownLoad); this.$refs.xingdownLoad.parentNode.removeChild(this.$refs.xingdownLoad);
this.$emit('child-colse', '1')
} }
} }
} }