@@ -4,6 +4,7 @@ import { Big } from "big.js";
4
4
import { CameraService } from '../camera/camera.service' ;
5
5
import html2canvas from 'html2canvas' ;
6
6
import { SocialSharing } from '@ionic-native/social-sharing/ngx' ;
7
+ import { ModalController } from '@ionic/angular' ;
7
8
8
9
@Component ( {
9
10
selector : 'app-total' ,
@@ -22,7 +23,8 @@ export class TotalComponent implements OnInit {
22
23
outCarTotal = { total : '0' , count : 0 } ;
23
24
constructor (
24
25
private camera : CameraService ,
25
- private socialSharing : SocialSharing
26
+ private socialSharing : SocialSharing ,
27
+ private modal : ModalController
26
28
) { }
27
29
28
30
ngOnInit ( ) {
@@ -125,12 +127,14 @@ export class TotalComponent implements OnInit {
125
127
*/
126
128
share ( ) {
127
129
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
+ } ) ;
132
136
} ) ;
133
- } ) ;
137
+ } )
134
138
} )
135
139
}
136
140
}
0 commit comments