Basic frontend uploader component

This commit is contained in:
dandds
2019-06-05 17:10:05 -04:00
parent e327a0bada
commit fb430e76e9
8 changed files with 114 additions and 20 deletions

View File

@@ -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
},
},
}