uni-app · 支付宝小程序踩坑

自己踩的:

    1.<canvas>要用id,而不是canvas-id,用的时候都写上
<canvas 
 style="position:absolute;left:-99999upx;background:#f1f1f1;" 
:style="{width:width+px,height:height+px}"
 canvas-id="qrcodeCanvas" 
 id="qrcodeCanvas"></canvas>
复制代码
    2.保存图片用my.saveImage,而不是saveImageToPhotosAlbum
// #ifdef MP-ALIPAY
if (type === 1) {
	my.saveImage({
		url: this.img,
		success: res => {
			console.log(saveImage, res)
			this.$success(保存成功)
		},
		fail: err => {
			console.error(saveImage err, err)
			this.$toast(保存失败)
		},
	})
}
// #endif
复制代码
    3.@click.stop好像不起作用

已知:

自己踩的: 1. 要用id,而不是canvas-id,用的时候都写上 复制代码 2.保存图片用my.saveImage,而不是saveImageToPhotosAlbum // #ifdef MP-ALIPAY if (type === 1) { my.saveImage({ url: this.img, success: res => { console.log(saveImage, res) this.$success(保存成功) }, fail: err => { console.error(saveImage err, err) this.$toast(保存失败) }, }) } // #endif 复制代码 3.@click.stop好像不起作用 已知:
经验分享 程序员 微信小程序 职场和发展