0.0.8-3 • Published 4 years ago
@onereach/or-file-uploader v0.0.8-3
@onereach/or-file-uploader
🗂 Vue component for uploading files.
Example
<or-file-uploader
ref="uploadFiles"
:isUploadPrivateEnabled="true"
:uploadPrivateDefaultValue="true"
:alwaysUploadPrivate="false"
:uploadedFileName="uploadedFileName"
@fileUploaded="fileUploadedHandler"
/>fileUploadedHandler ({ fileName, type, content, isPublic }) {
this.uploadedFileName = ''
setTimeout(() => {
const file = new Blob([content], { type })
const fileModel = { fileName, file, type }
// use fileModel to make http request for uploading
// use isPublic to determine whether it's public uploading
// this.$http.post(...)
// set uploadedFileName to the filename that succeeded was uploaded
this.uploadedFileName = fileName
}, Math.round(Math.random() * 3000))
}Props
uploadedFileName: String default:
''Use to indicate if fileUploaded handler finished uploading the specified file
isUploadPrivateEnabled: Boolean default:
trueIndicates whether private uploading is enabled
uploadPrivateDefaultValue: Boolean default:
trueThe property specifies the default value for the checkbox 'Make private'
alwaysUploadPrivate: Boolean default:
falseForce to upload the file as private only
Methods
fileUploaded
Emitted when the file is ready for uploading to back.
Handler is called with
fileName, type, content, isPublicparams, e. g.
{
fileName:'test.json',
type: 'application/json',
content: ArrayBuffer(17),
isPublic: false
}closeButtonClicked
Emitted when close button was clicked.