clear fileupload after uploading

This commit is contained in:
Randell L Hodges 2020-10-27 07:46:17 -05:00 committed by meteyou
parent 9057bea653
commit 6282356ddd

View File

@ -319,7 +319,10 @@
methods: { methods: {
uploadFile: function() { uploadFile: function() {
if (this.$refs.fileUpload.files.length) { if (this.$refs.fileUpload.files.length) {
this.doUploadFile(this.$refs.fileUpload.files[0]); this.doUploadFile(this.$refs.fileUpload.files[0]).finally(() => {
this.$refs.fileUpload.value = '';
});
} }
}, },
doUploadFile: function(file) { doUploadFile: function(file) {
@ -330,7 +333,7 @@
formData.append('file', file, (this.currentPath+"/"+filename).substring(7)); formData.append('file', file, (this.currentPath+"/"+filename).substring(7));
this.$store.commit('setLoading', { name: 'loadingGcodeUpload' }); this.$store.commit('setLoading', { name: 'loadingGcodeUpload' });
axios.post('//' + this.hostname + ':' + this.port + '/server/files/upload', return axios.post('//' + this.hostname + ':' + this.port + '/server/files/upload',
formData, { formData, {
headers: { 'Content-Type': 'multipart/form-data' } headers: { 'Content-Type': 'multipart/form-data' }
} }
@ -624,4 +627,4 @@
} }
} }
} }
</script> </script>