mirror of
http://112.124.100.131/GFRS/ebiz-h5.git
synced 2025-12-09 23:56:43 +08:00
更换贺报下载的方法31
This commit is contained in:
@@ -77,37 +77,33 @@ export default {
|
||||
},
|
||||
// 分享
|
||||
fenxiang() {
|
||||
if(this.$refs.xingdownLoad != this.$refs.xingdownLoad) {
|
||||
return
|
||||
}
|
||||
// const element = document.getElementById('capture')
|
||||
// const canvas = await html2canvas(element)
|
||||
html2canvas(this.$refs.xingdownLoad, {
|
||||
width: this.$refs.xingdownLoad.offsetWidth,
|
||||
height: this.$refs.xingdownLoad.offsetHeight,
|
||||
backgroundColor: '#fff',
|
||||
scale: 2,
|
||||
dpi: 300
|
||||
}).then((canvas) => {
|
||||
console.log('分享');
|
||||
// 将 canvas 转换为 Blob
|
||||
canvas.toBlob((blob) => {
|
||||
this.blobToBase64(blob).then((base64String) => {
|
||||
let base64Manane = base64String.split(',')[1]
|
||||
console.log(base64Manane);
|
||||
EWebBridge.webCallAppInJs('bridge', {
|
||||
flag: 'share',
|
||||
extra: {
|
||||
shareType: '1',
|
||||
base64: base64Manane
|
||||
}
|
||||
})
|
||||
html2canvas(this.$refs.xingdownLoad, {
|
||||
width: this.$refs.xingdownLoad.offsetWidth,
|
||||
height: this.$refs.xingdownLoad.offsetHeight,
|
||||
backgroundColor: '#fff',
|
||||
scale: 2,
|
||||
dpi: 300,
|
||||
useCORS: true,
|
||||
allowTaint: true,
|
||||
}).then((canvas) => {
|
||||
console.log('分享');
|
||||
// 将 canvas 转换为 Blob
|
||||
canvas.toBlob((blob) => {
|
||||
this.blobToBase64(blob).then((base64String) => {
|
||||
let base64Manane = base64String.split(',')[1]
|
||||
console.log(base64Manane);
|
||||
EWebBridge.webCallAppInJs('bridge', {
|
||||
flag: 'share',
|
||||
extra: {
|
||||
shareType: '1',
|
||||
base64: base64Manane
|
||||
}
|
||||
})
|
||||
}, 'image/png')
|
||||
})
|
||||
setTimeout(() => {
|
||||
this.close()
|
||||
}, 3000);
|
||||
})
|
||||
}, 'image/png')
|
||||
})
|
||||
},
|
||||
// 生成图片并下载
|
||||
domToImage() {
|
||||
@@ -125,7 +121,9 @@ export default {
|
||||
height: domElement.offsetHeight,
|
||||
backgroundColor: '#fff',
|
||||
scale: 1,
|
||||
dpi: 300
|
||||
dpi: 300,
|
||||
useCORS: true,
|
||||
allowTaint: true,
|
||||
});
|
||||
console.log('下载',canvas);
|
||||
// 将画布转换为 Blob,并等待其完成
|
||||
@@ -167,8 +165,6 @@ export default {
|
||||
|
||||
close() {
|
||||
console.log(15434678);
|
||||
// document.documentElement.removeChild(this.$refs.xingdownLoad)
|
||||
// this.$refs.xingdownLoad.removeChild(this.$refs.xingdownLoad);
|
||||
document.getElementById('capture').innerHTML = '';
|
||||
this.$emit('child-colse', '1')
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user