Basic frontend uploader component
This commit is contained in:
@@ -29,7 +29,7 @@ export default {
|
||||
const pdf = this.initialData
|
||||
|
||||
return {
|
||||
showUpload: !pdf || this.uploadErrors.length > 0,
|
||||
attachment: pdf || null,
|
||||
}
|
||||
},
|
||||
|
||||
@@ -37,5 +37,24 @@ export default {
|
||||
showUploadInput: function() {
|
||||
this.showUpload = true
|
||||
},
|
||||
addAttachment: function(e) {
|
||||
this.attachment = e.target.value
|
||||
},
|
||||
removeAttachment: function(e) {
|
||||
e.preventDefault()
|
||||
this.attachment = null
|
||||
this.$refs.attachmentInput.value = null
|
||||
},
|
||||
},
|
||||
|
||||
computed: {
|
||||
baseName: function() {
|
||||
if (this.attachment) {
|
||||
return this.attachment.split(/[\\/]/).pop()
|
||||
}
|
||||
},
|
||||
hasAttachment: function() {
|
||||
return !!this.attachment
|
||||
},
|
||||
},
|
||||
}
|
||||
|
Reference in New Issue
Block a user