my.MQDownloadFiles

Description: Provides mini program JavaScript API support for file download function.

Sample Code

copy
my.call('MQDownloadFiles',{ parameters: {
            fileType: "HTML",
            fileName: "20240501919092",
            fileUrl: "https://{your-file-server-host}/download/20240501919092.html",
            content: "3vg9CJBhzUJBXCNaGvALFWUfAPLZd9p9I3wfBBTyQyIIlXWKW/sj3QcCAPYOQATiHMGhm4pscJe6SkzaHqks....",
    }
})

Parameters

Name

Type

Required

Description

parameters

Dictionary<String : Any>

true

The ID can be String/Double/Int/Pool

| fileType

String

M

File types, currently supported types:

1. PDF (PDF file)

2. DOCX (Word file)

3. OFORM and DOCXF formularios relenerables (Export to PDF format, uniformly defined as PDF file type, no need to define type)

4. XLSX (XLSX hojas de c á lculo. native spreadsheet format of Microsoft Excel)

5. PPTX (PPTX presentations.)

6. HTML (HTML p á ginas web.)

7. ODT (OpenDocument text file)

8. TXT (text file)

| fileName 

String

M

File name (mainly used for local caching, logic for opening other apps)

| fileUrl

String

M

Choose one of the fileUrl/content parameters, priority: fileUrl>content. Use the file download link first to download the file. If the file download link is empty, use base64 file content to download the file

Success Callback Function

Name

Type

Required

Description

success

Bool

true

Is the JSAPI call successful

code

Int

true

0: Successful,

-1: Failed,

-99: User cancellation

1001: Parameter error

message

String

false