$("#qrcode").qrcode({ render: "canvas", text:'http://baidu.com/<?PHP echo $this->detailData['id'];?>', width: 100, height: 100 }) $("#downEwm").click(function (){ let canvas = document.getElementsByTagName('canvas')[0] let base64Img = canvas.toDataURL() let link = document.createElement('a') link.href = base64Img link.download = 'code'+ Date.now() let event = document.createEvent('MouseEvents') event.initMouseEvent('click',true,false,window,0,0,0,0,0,false,false,false,false,0,null) link.dispatchEvent(event) })
本文为看恩吧原创文章,转载无需和我联系,但请注明来自knsay.com