Skip to content

Upload 上傳 ​

按鈕選檔,清單顯示進度與狀態。圖片卡片與拖曳區要另外打開。進度條是品牌金,成功與失敗都有圖示和文字。

內建傳輸會模擬進度,方便沒有上傳網址時先看介面。正式上傳請傳 customRequest。裁切與燈箱預覽不在這一版。

範例 ​

清單

預設 list-type="list"、dragger 關閉。按鈕高度 28 / 34 / 40。

拖曳區

圖片卡片

尺寸、上限、停用

放進表單

API ​

value 與 file-list 是同一份 UploadFile[]。status 為 pending、uploading、success、error。

multiple 關閉時,新選的檔案會換掉清單。max 到達後觸發器停用,並顯示「已達上限」。default-upload="false" 時檔案停在等待,呼叫 upload() 才開始。

before-upload 可以 preventDefault()。customRequest 收到 { file, fileItem, onProgress, onSuccess, onError }。

事件還有 progress、success、error、remove、retry、preview。change 的 detail 是 { fileList, value }。

trigger slot 取代按鈕或拖曳區。file slot 取代清單。empty 是清單為空時的選用提示。

要關掉預設為開的開關,屬性請寫 false,例如 show-file-list="false"。