我正在使用vuetify-upload-button组件来上传文件。使用仅获取文件加载的函数回调fileChangedCallback
。
但是,我需要具有额外的参数才能做出逻辑。可以向该函数传递额外的参数吗?
这是我的代码:
v-flex.listFilesUpload(v-for="(file, index) in attachments" :key="index")
p
span
| {{ index + 1 }}
.btns-upload-download
upload-btn(title="File" :fileChangedCallback="fileChanged" color="default")
import UploadButton from 'vuetify-upload-button'
export default {
[..]
methods: {
fileChanged (file) {
// Here I need my other variable file because it have the filename.
if (file) {
formData.append('filenames[]', file)
}
},
components: {
'upload-btn': UploadButton
}
}
}