場景:
?項目中需要回顯文件上傳的數(shù)據(jù)
上傳文件時,代碼處理
newAttachData = newAttachData.concat(e.file.response.data.files)
刪除時的處理
newAttachData = newAttachData.filter((item, i) => { return i !== index });
之前文件刪除的時候采用的是class組件中的經(jīng)典寫法,newAttachData.splice(index,1),但是發(fā)現(xiàn)hooks組件不監(jiān)聽這個寫法,只能采用這種寫法.