downLoad(){
			
				var timestamp = (new Date()).valueOf();
				        var downLoader = plus.downloader.createDownload(this.img, {
							
				            method: 'GET',
							
				            filename: '_downloads/image/' + timestamp + '.png'
				        }, function(download, status) {
							console.log(status)
							
				          if(status==200){
				            var fileName = download.filename;
							
				            /**
				             * 保存至本地相册
				             */
							console.log(fileName)
				            plus.gallery.save(fileName, function() {
								uni.showToast({
									icon:'success',
									title:'保存二维码图片成功',
									
								})
								
				            },function(){
								uni.showToast({
									icon:'success',
									title:'保存失败,请重试',
									
								})
				            });
				          }else{
							  uni.showToast({
							  	icon:'success',
							  	title:'下载失败,请重试',
							  	
							  })
				          }
				        });
				         downLoader.start();
				
				
			},
Logo

前往低代码交流专区

更多推荐