我对在 v3.8 中使用进度事件(使用 jQuery 包装器)有点困惑我知道只有某些浏览器支持ProgressEvent
接口,所以我在 Firefox v20.0.1 中对此进行测试。
使用其他一些代码,我添加了这个:
.on('progress', function (id, filename, uploadedBytes, totalBytes)
{
alert('uploadedBytes: ' + uploadedBytes + '\n totalBytes: ' + totalBytes);
if (uploadedBytes < totalBytes) {
progress = '"' + fileName + '" uploading... ' + Math.round(uploadedBytes / totalBytes*100) +'%';
$('#qq-progress-bar').html(progress);
}
else {
$('#qq-progress-bar').html('saving');
}
})
请查看上面此事件中的 ALERT 功能。如果该方法的输入参数正确,我应该不会在“uploadedBytes”参数中看到上传文件的名称。totalBytes 参数似乎是正确的。警报显示如下:
我可以在某些浏览器(例如 FireFox v20.0.1)中明显看到进度条,但进度条没有进度。此外,上传量的百分比值并没有太大作用。我会看到一个值,然后它就会完成。
为了让这一切出现,我正在更改文件模板中命名的“qq-progress-bar”。我是要解决这个问题还是让它变得比我需要的更复杂?我只需要显示进度,文本值不是必需的,但肯定很好。例子?想法?
谢谢!