我正在尝试在使用 axios 创建的获取请求期间创建进度加载指示器,但 progressEvent.total
始终为 0
。用axios提供的onDownloadProgress
(progressEvent
)还有其他方法可以准确计算吗?这是对象:
progress
bubbles: false
cancelBubble: false
cancelable: false
composed: false
currentTarget: null
defaultPrevented: false
eventPhase: 0
explicitOriginalTarget: XMLHttpRequest { readyState: 4, timeout: 0, withCredentials: false, … }
isTrusted: true
lengthComputable: false
loaded: 9924
originalTarget: XMLHttpRequest { readyState: 4, timeout: 0, withCredentials: false, … }
returnValue: true
srcElement: XMLHttpRequest { readyState: 4, timeout: 0, withCredentials: false, … }
target: XMLHttpRequest { readyState: 4, timeout: 0, withCredentials: false, … }
timeStamp: 23792
total: 0
type: "progress"
<get isTrusted()>: function isTrusted()
<prototype>: ProgressEventPrototype { lengthComputable: Getter, loaded: Getter, total: Getter, … }