Skip to content

Commit 313d5b4

Browse files
committed
更新分享方案
1 parent 1930d12 commit 313d5b4

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/app/common/total/total.component.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { Big } from "big.js";
44
import { CameraService } from '../camera/camera.service';
55
import html2canvas from 'html2canvas';
66
import { SocialSharing } from '@ionic-native/social-sharing/ngx';
7+
import { ModalController } from '@ionic/angular';
78

89
@Component({
910
selector: 'app-total',
@@ -22,7 +23,8 @@ export class TotalComponent implements OnInit {
2223
outCarTotal = { total: '0', count: 0 };
2324
constructor(
2425
private camera: CameraService,
25-
private socialSharing: SocialSharing
26+
private socialSharing: SocialSharing,
27+
private modal: ModalController
2628
) { }
2729

2830
ngOnInit() {
@@ -125,12 +127,14 @@ export class TotalComponent implements OnInit {
125127
*/
126128
share() {
127129
const element = document.getElementById('content_box');
128-
html2canvas(element).then(canvas => {
129-
canvas.toBlob(content => {
130-
this.camera.saveFile(content, new Date().toDateString()).then((path: string) => {
131-
this.socialSharing.share(null, null, path, null).then(() => { }, err => console.log('分享失败', err))
130+
this.modal.getTop().then((modal: any) => {
131+
html2canvas(modal).then(canvas => {
132+
canvas.toBlob(content => {
133+
this.camera.saveFile(content, new Date().toDateString()).then((path: string) => {
134+
this.socialSharing.share(null, null, path, null).then(() => { }, err => console.log('分享失败', err))
135+
});
132136
});
133-
});
137+
})
134138
})
135139
}
136140
}

0 commit comments

Comments
 (0)