下载bug
This commit is contained in:
parent
4bf261df57
commit
b449ebeb8d
@ -361,20 +361,36 @@ const handleBind = (record) => {
|
||||
}
|
||||
|
||||
const handleDown = async (record) => {
|
||||
await nextTick();
|
||||
const rowElement = document.querySelector(`[data-row-key="${record.batteryCode}"]`);
|
||||
var canvas = rowElement.querySelector('Canvas')
|
||||
if (canvas) {
|
||||
const url = canvas.toDataURL();
|
||||
const a = document.createElement('a');
|
||||
a.download = `${record.batteryCode}.png`;
|
||||
a.href = url;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
document.body.removeChild(a);
|
||||
} else {
|
||||
console.error('Row element not found');
|
||||
}
|
||||
const{base64QrCode,batteryCode}=record;
|
||||
console.log(record)
|
||||
const link = document.createElement('a')
|
||||
link.href = base64QrCode
|
||||
link.download = batteryCode
|
||||
|
||||
// 兼容旧版浏览器
|
||||
if (document.createEvent) {
|
||||
const event = new MouseEvent('click')
|
||||
link.dispatchEvent(event)
|
||||
} else {
|
||||
link.click()
|
||||
}
|
||||
|
||||
// 清理临时元素
|
||||
document.body.removeChild(link)
|
||||
// await nextTick();
|
||||
// const rowElement = document.querySelector(`[data-row-key="${record.batteryCode}"]`);
|
||||
// var canvas = rowElement.querySelector('Canvas')
|
||||
// if (canvas) {
|
||||
// const url = canvas.toDataURL();
|
||||
// const a = document.createElement('a');
|
||||
// a.download = `${record.batteryCode}.png`;
|
||||
// a.href = url;
|
||||
// document.body.appendChild(a);
|
||||
// a.click();
|
||||
// document.body.removeChild(a);
|
||||
// } else {
|
||||
// console.error('Row element not found');
|
||||
// }
|
||||
}
|
||||
|
||||
const handleSelect = (record) => {
|
||||
|
||||
@ -365,20 +365,36 @@ const handleBind = (record) => {
|
||||
}
|
||||
|
||||
const handleDown = async (record) => {
|
||||
await nextTick();
|
||||
const rowElement = document.querySelector(`[data-row-key="${record.bikeCode}"]`);
|
||||
var canvas = rowElement.querySelector('Canvas')
|
||||
if (canvas) {
|
||||
const url = canvas.toDataURL();
|
||||
const a = document.createElement('a');
|
||||
a.download = `${record.bikeCode}.png`;
|
||||
a.href = url;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
document.body.removeChild(a);
|
||||
} else {
|
||||
console.error('Row element not found');
|
||||
}
|
||||
const{base64QrCode,bikeCode}=record;
|
||||
const link = document.createElement('a')
|
||||
link.href = base64QrCode
|
||||
link.download = bikeCode
|
||||
|
||||
// 兼容旧版浏览器
|
||||
if (document.createEvent) {
|
||||
const event = new MouseEvent('click')
|
||||
link.dispatchEvent(event)
|
||||
} else {
|
||||
link.click()
|
||||
}
|
||||
|
||||
// 清理临时元素
|
||||
document.body.removeChild(link)
|
||||
// await nextTick();
|
||||
// console.log("66666666666666666666666",record)
|
||||
// const rowElement = document.querySelector(`[data-row-key="${record.bikeCode}"]`);
|
||||
// var canvas = rowElement.querySelector('Canvas')
|
||||
// if (canvas) {
|
||||
// const url = canvas.toDataURL();
|
||||
// const a = document.createElement('a');
|
||||
// a.download = `${record.bikeCode}.png`;
|
||||
// a.href = url;
|
||||
// document.body.appendChild(a);
|
||||
// a.click();
|
||||
// document.body.removeChild(a);
|
||||
// } else {
|
||||
// console.error('Row element not found');
|
||||
// }
|
||||
}
|
||||
|
||||
const handleSelect = (record) => {
|
||||
|
||||
@ -361,20 +361,36 @@ const handleBind = (record) => {
|
||||
}
|
||||
|
||||
const handleDown = async (record) => {
|
||||
await nextTick();
|
||||
const rowElement = document.querySelector(`[data-row-key="${record.helmetCode}"]`);
|
||||
var canvas = rowElement.querySelector('Canvas')
|
||||
if (canvas) {
|
||||
const url = canvas.toDataURL();
|
||||
const a = document.createElement('a');
|
||||
a.download = `${record.helmetCode}.png`;
|
||||
a.href = url;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
document.body.removeChild(a);
|
||||
} else {
|
||||
console.error('Row element not found');
|
||||
}
|
||||
const{base64QrCode,helmetCode}=record;
|
||||
console.log(record)
|
||||
const link = document.createElement('a')
|
||||
link.href = base64QrCode
|
||||
link.download = helmetCode
|
||||
|
||||
// 兼容旧版浏览器
|
||||
if (document.createEvent) {
|
||||
const event = new MouseEvent('click')
|
||||
link.dispatchEvent(event)
|
||||
} else {
|
||||
link.click()
|
||||
}
|
||||
|
||||
// 清理临时元素
|
||||
document.body.removeChild(link)
|
||||
// await nextTick();
|
||||
// const rowElement = document.querySelector(`[data-row-key="${record.helmetCode}"]`);
|
||||
// var canvas = rowElement.querySelector('Canvas')
|
||||
// if (canvas) {
|
||||
// const url = canvas.toDataURL();
|
||||
// const a = document.createElement('a');
|
||||
// a.download = `${record.helmetCode}.png`;
|
||||
// a.href = url;
|
||||
// document.body.appendChild(a);
|
||||
// a.click();
|
||||
// document.body.removeChild(a);
|
||||
// } else {
|
||||
// console.error('Row element not found');
|
||||
// }
|
||||
}
|
||||
|
||||
const handleSelect = (record) => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user