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