结合a-upload使用时,只需要在上传前调用以下代码即可
let url = URL.createObjectURL(this.file);
let audioElement = new Audio(url);
let duration = parseInt(audioElement.duration);
audioElement.addEventListener("loadedmetadata",
() => {
this.duration = parseInt(audioElement.duration); //时长为秒,取整
console.log(this.duration);
});