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
- [Vuejs]-Laravel vue Column not found: 1054 Unknown
- [Vuejs]-Auto fill input field after Select dropdown list [ Laravel, Vuejs ]
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)
Source:stackexchange.com