<form name="documentForm" ref="form" @submit.prevent = "store$" method="post" enctype="multipart/form-data">
<el-upload :on-change="handleChange" :file-list="create$.file" action="" class="upload-demo" ref="upload" multiple :auto-upload="false">
<v-btn slot="trigger">Upload</v-btn>
</el-upload>
<v-btn color="blue darken-1" flat form="documentForm" type="submit">Save</v-btn>
</form>
new Vue({
methods:{
store$(){
var vm = this var store$ = new FormData(vm.$refs.form); store$.append('category_id', vm.create$.category_id )
_.map(vm.create$.file, function(data){
store$.append('file[]', data.raw )
})
post('/api/documents', store$).then(function (response) {
vm.$set(vm.$root.$data.documents, vm.$root.$data.documents.length, response.data )
vm.$root.successResponse('Create A Document')
vm.$router.push('/documents')
}).catch(function (_ref2) {
vm.$root.errorResponse(_ref2)
});
}
})
No comments:
Post a Comment