JS上传文件重命文件名
// 选择图片后的处理 handleSelect(file, fileList) { let image = new Image() image.src = file.url image.onload = () => { if (image.width > 900) { compressImage(image).then(res=>{ this.uploadImage(res) }) } else { //给图片重新命名,以免同名被覆盖 const filename = file.uid + this.$cache.local.getJSON('bestUserInfo').userId + file.name const renameFile = new File([file.raw], filename, {type: 'image/jpeg', lastModified: Date.now()}); this.uploadImage(renameFile) } } },

浙公网安备 33010602011771号