Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

文件上传前无法修改文件名 #362

Open
louxu623 opened this issue Sep 1, 2023 · 0 comments
Open

文件上传前无法修改文件名 #362

louxu623 opened this issue Sep 1, 2023 · 0 comments

Comments

@louxu623
Copy link

louxu623 commented Sep 1, 2023

文件上传组件:
<wd-upload
v-model="planForm.fileList"
multiple
:limit="3"
:before-upload="imgBeforeUpload"
@exceed="imgUploadLimit"
@success="imgUploadSuccess"
@remove="imgRemoveSuccess"
:action="uploadUrl">

上传文件之前的钩子:
imgBeforeUpload ({ files, fileList, resolve }) {
for (let i = 0; i < files.length; i++) {
console.log(files[i].name);
let suffix = files[i].name.substring(files[i].name.lastIndexOf(".")); //.txt
files[i].name = 'dispatch-' + this.generateUniqueString() + suffix
console.log(customFile.name)
}
resolve(true)
},

以上,文件名修改不生效,各种方法都尝试过了。麻烦帮忙看看是啥原因哦,感谢!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant