0.0.7 • Published 2 years ago
@onereach/or-file-uploader-next v0.0.7
@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:
true
Indicates whether private uploading is enabled
uploadPrivateDefaultValue: Boolean default:
true
The property specifies the default value for the checkbox 'Make private'
alwaysUploadPrivate: Boolean default:
false
Force 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, isPublic
params, e. g.
{
fileName:'test.json',
type: 'application/json',
content: ArrayBuffer(17),
isPublic: false
}
closeButtonClicked
Emitted when close button was clicked.