保存画布到本地出现的bug和画布的隐藏

和隔壁画布隐藏一起,卡了我几个小时…
保存相册失败后,再次授权

// 下载
			btn() {
				uni.canvasToTempFilePath({
					// x: 100,
					// y: 200,
					// width: 50,
					// height: 50,
					// destWidth: 100,
					// destHeight: 100,
					fileType: 'jpg',
					canvasId: 'myCanvas',
					success: function(res) {
						// 在H5平台下,tempFilePath 为 base64
						console.log(res.tempFilePath)
						uni.saveImageToPhotosAlbum({
							filePath: res.tempFilePath,
							success: () => {
								console.log('save success');
								uni.showToast({
									title: '下载成功,请进入相册查看',
									duration: 2000
								});
							},
							fail: (err) => {
								if (err.errMsg === 'saveImageToPhotosAlbum:fail auth deny') {
									uni.showModal({
										content: '检测到您没打开获取信息功能权限,是否去设置打开?',
										confirmText: "确认",
										cancelText: '取消',
										success: (res) => {
											if (res.confirm) {
												uni.openSetting({
													success: (res) => {
														console.log(res);
														uni.showToast({
															icon: "none",
															title: "请重新点击联单下载保存图片"
														});
													}
												})
											} else {
												uni.showToast({
													icon: "none",
													title: "保存失败,请打开权限功能重试"
												});
											}
										}
									})
								} else {
									// console.log(res);
									uni.showToast({
										icon: 'none',
										title: '下载失败:' + err.errMsg
									});
								}
							}
						});

画布要下载必须有这个dom,所有v-if和v-show都没用,宽高0也没用,用下面这css,可以让他在页面上又不显示

position: fixed;
left: 100%;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值