Jelajahi Sumber

add ui.upload.reset()

Falko Schindler 2 tahun lalu
induk
melakukan
2eba4d7430
2 mengubah file dengan 6 tambahan dan 0 penghapusan
  1. 3 0
      nicegui/elements/upload.py
  2. 3 0
      nicegui/elements/upload.vue

+ 3 - 0
nicegui/elements/upload.py

@@ -41,3 +41,6 @@ class Upload(Element):
             ]
             handle_event(on_upload, UploadEventArguments(sender=self, client=self.client, files=files))
         self.on('upload', upload, ['*'])
+
+    def reset(self) -> None:
+        self.run_method('reset')

+ 3 - 0
nicegui/elements/upload.vue

@@ -26,6 +26,9 @@ export default {
       }));
       this.$emit("upload", args);
     },
+    reset() {
+      this.file = undefined;
+    },
   },
   props: {
     multiple: Boolean,