downloadFile

Diese Funktion ermöglicht einen Datei-Download.

Übersicht

action ("downloadFile")

Auszuführende Aktion.

payload (DownloadFileActionPayload)

Definiert Inhalt der herunterzuladenden Datei.

DownloadFileActionPayload

base64Encoded (boolean)

Gibt an, ob die Datei base64 kodiert ist.

data (string)

Inhalt der Datei.

fileName (string)

Name der Datei.

mimeType (string)

Typ der Datei.

Beispiel

downloadFile.json
{
  "$schema": "https://forms.virtimo.net/5.0.x/schema.json",
  "metaData": {
    "id": "0",
    "version": 0
  },
  "configuration": {
  },
  "components": [
    {
      "type": "container",
      "components": [
        {
          "type": "button",
          "label": "Download base64 encoded file",
          "onClick": {
            "action": "downloadFile",
            "payload": {
              "base64Encoded": true,
              "data": "PG1zZz4KPGNvbnRlbnQ+SGVsbG8gV29ybGQ8L2NvbnRlbnQ+CjwvbXNnPg==",
              "fileName" : "testfile.xml",
              "mimeType": "application/xml"
            }
          }
        },
        {
          "type": "button",
          "label": "Download textfile",
          "onClick": {
            "action": "downloadFile",
            "payload": {
              "fileName" : "testfile.txt",
              "data": "Hello World"
            }
          }
        }
      ]
    }
  ]
}
Eingebettete Vorschau

Keywords: