我看了下社区的帖子和Upload-flow的Issue,都提到过在Upload的事件监听器使用System.out没反应(貌似是标准流被重新设置了?)
所以我就试着事件发生弹出个对话框看看,结果依旧不行。
FileBuffer buffer = new FileBuffer();
Upload upload = new Upload(buffer);
final Button button = new Button("批量导入");
button.addThemeVariants(ButtonVariant.LUMO_TERTIARY);
upload.setDropAllowed(false);
upload.setAutoUpload(true);
upload.setUploadButton(button);
upload.setAcceptedFileTypes("application/xls,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
upload.setMaxFileSize(1024*1024*5);
upload.addFinishedListener(event -> new Dialog().open());
upload.addSucceededListener(event -> new Dialog().open());
upload.addFailedListener(event -> new Dialog().open());
upload.addStartedListener(event -> new Dialog().open());
upload.addProgressListener(event -> new Dialog().open());