pagekit / vue-resource

The HTTP client for Vue.js
MIT License
10.09k stars 1.6k forks source link

使用progress监听不到变化的过程,直接返回100% #711

Open shihaha opened 5 years ago

shihaha commented 5 years ago

相关代码块儿如下:

this.$http.post('/api/XXX', this.XXX, {
    progress: progressEvent => {
        if (progressEvent.lengthComputable) {
            this.$nextTick(() => {
                // this.percent = Math.ceil((progressEvent.loaded / progressEvent.total) * 100);
                console.log(Math.ceil((progressEvent.loaded / progressEvent.total) * 100));
            })
        }
    }
}).then(({ data: { code, data, message } }) => {

只能打印出100,没有progress的变化过程,请问该怎么改?