鍍金池/ 問答/HTML/ element upload 報錯Cannot set property 'st

element upload 報錯Cannot set property 'status' of null

使用element UI的upload組件,打開頁面的時候默認從后臺加載文件信息,然后顯示進去。問題:這個時候用戶去刪除這個后臺的文件,在上傳新的文件的時候報錯

**Uncaught TypeError: Cannot set property 'status' of null**
    at VueComponent.handleProgress (element-ui.common.js:24984)
    at Object.onProgress (element-ui.common.js:25506)
    at XMLHttpRequestUpload.progress (element-ui.common.js:25638)

在網(wǎng)上找到一個類似的答案 結論是不可以更改:file-list的值,我把后臺文件url存了起來充值寫進去。還是報錯!

圖片如下:

圖片描述

圖片描述
打開了報錯打了個斷點 file已經拿到了
問題就在file的status屬性從ready 更改成uoloading 報file對象沒有status屬性的錯誤
求解決!!
圖片說明如下:圖片描述圖片描述

回答
編輯回答
帥到炸

參考網(wǎng)上資料解決了,原因是在file-list內的變量是只讀的,我通過多聲明了一個變量,一個用來讀一個用來寫解決的

2018年1月11日 21:40