[Vuejs]-Process toFormData from view

0👍

The problem is that toFormData is not a method on your instance (Vue does not come with any predefined instance methods, except for lifecycle hooks). You would also have to access instance methods through this.method().

Could you mean the HTML FormData API instead?
https://developer.mozilla.org/en-US/docs/Web/API/FormData

0👍

You can create a computed property and inside it prepare your form data for request. Iterate over JSON properties and add each data to form data. Or you can add ref=“form” to form and use like this:
var formData = new FormData(this.$refs.form)

Leave a comment