mirror of
https://github.com/gradio-app/gradio.git
synced 2025-02-23 11:39:17 +08:00
Trigger click event from gr.DownloadButton
even when no file is present (#7862)
* trigger click event download button * add changeset --------- Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
This commit is contained in:
parent
425fd1ca9d
commit
0e125d7bef
6
.changeset/famous-wings-shout.md
Normal file
6
.changeset/famous-wings-shout.md
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
"@gradio/downloadbutton": patch
|
||||
"gradio": patch
|
||||
---
|
||||
|
||||
fix:Trigger click event from `gr.DownloadButton` even when no file is present
|
@ -16,6 +16,7 @@
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
function download_file(): void {
|
||||
dispatch("click");
|
||||
if (!value?.url) {
|
||||
return;
|
||||
}
|
||||
@ -33,7 +34,6 @@
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
document.body.removeChild(a);
|
||||
dispatch("click");
|
||||
}
|
||||
</script>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user