Created
November 7, 2019 02:49
-
-
Save ambrizals/821829df85cbf0ab66ce568b60ebefda to your computer and use it in GitHub Desktop.
Original Code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uploadCover() { | |
this.progressDialog = true | |
let formData = new FormData() | |
formData.append('cover_article', this.imgCover) | |
upload.post('atk/posts/cover/'+this.params, formData).then((res) => { | |
this.form.coverArticle = res.data | |
this.imgCover = null | |
this.progressDialog = false | |
this.updateCover = false | |
}).catch(() => { | |
this.progressDialog = false | |
this.updateCover = false | |
}) | |
}, |
atau coba pakai
Kalau di bagian ini
<v-file-input label="Cover Images" prepend-icon="mdi-camera" accept="image/png, image/jpeg, image/bmp" v-model="imgCover"></v-file-input>
dirubah ke
<v-file-input label="Cover Images" prepend-icon="mdi-camera" ref="file" accept="image/png, image/jpeg, image/bmp" v-model="imgCover"></v-file-input>
asumsi bagian data seperti ini
data: { file: "", },
dan bagian method
uploadCover
add inithis.file = this.$refs.file.files[0]; let formData = new FormData(); formData.append('file', this.file);
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
atau coba pakai
Kalau di bagian ini
<v-file-input label="Cover Images" prepend-icon="mdi-camera" accept="image/png, image/jpeg, image/bmp" v-model="imgCover"></v-file-input>
dirubah ke
<v-file-input label="Cover Images" prepend-icon="mdi-camera" ref="file" accept="image/png, image/jpeg, image/bmp" v-model="imgCover"></v-file-input>
asumsi bagian data seperti ini
dan bagian method
uploadCover
add ini