Interesting download error when trying to download html canvas as image with button
问题 When I first click the button it doesn't work. On my second click it downloads 1 picture. My 3rd click it downloads 2 pictures. On my 4th click it downloads 3 pictures. So 1-0, 2-1, 3-2, 4-3. They are also downloaded immediately, it doesn't ask where to save. js: function xyz(){ const text =canvas.api.getCanvasAsImage(); const download = document.getElementById('download'); download.addEventListener('click', function(e) { var link = document.createElement('a'); link.download = 'download.png';