Syncfusion 文件管理器下载文件不起作用

问题描述

我正在使用同步融合文件管理器。我想要做的是下载一个文件。文档说要下载文件,只需要在downloadUrl中设置ajaxSettings。但是,当我执行此操作并尝试右键单击并下载时,页面重定向到我在 downloadUrl 中提供的 url。

component.ts

import { FileManagerComponent } from '@syncfusion/ej2-angular-filemanager';
...
this.ajaxSettings = {
    url: baseAPIUrl + '/file-operation',uploadUrl: baseAPIUrl + '/file-upload',downloadUrl: baseAPIUrl + '/file-download'
}

component.html

<ejs-filemanager id='default-filemanager' #filemanagerObj [ajaxSettings]='ajaxSettings' [view]='view'>
</ejs-filemanager>

在查看文档时,很难找到解决方案,并且没有关于下载文件的任何有用信息。有人可以帮助我,在此先感谢。

解决方法

请按照以下步骤运行 FileManager 组件。

  1. 从以下链接克隆 ASP.NET 核心文件提供程序服务,

服务链接:https://github.com/SyncfusionExamples/ej2-aspcore-file-provider

  1. 使用 Visual Studio 运行解决方案文件。

  2. 在下面示例的 app.component.ts 文件中添加本地主机地址。

https://stackblitz.com/edit/angular-filemanager-core-service-vvfa24?file=app.component.ts

  1. 现在,FileManager 组件将呈现。下载操作适用于上述示例。

请参阅以下链接以了解有关文件管理器组件的更多信息。

文档:https://ej2.syncfusion.com/angular/documentation/file-manager/getting-started/

演示:https://ej2.syncfusion.com/angular/demos/#/material/file-manager/overview

API:https://ej2.syncfusion.com/angular/documentation/api/file-manager/