Very nice component! I am trying to submit the form using a 'submit' field. However, I can not seem to get it working when I pass the onSubmit option of the submit button a callback.
Offcourse, I can do submission inline just there, but that's not clean.
For the moment I just have everything inside my root Vue element and trying to pass the onSubmit a callback that I put in the 'methods' object just does nothing.
Could you make a jsfieddle from the problem?
Hey @pimhooghiemstra
This is a working example https://jsfiddle.net/0mg1v81e/198/
I totally get your point there. When you try to pass a callback it doesn't work https://jsfiddle.net/0mg1v81e/201/
This is mainly due to the fact that vue doesn't recognize other instance details inside data. When you declare data you can't access this.myMethod or some computed because it will blow everything apart when something changes.
A very simple option would be to place the button separately https://jsfiddle.net/0mg1v81e/202/
Maybe I'm missing something there @icebob ?
It's working with method too, just in this case data have to be function and this won't be undefined.
@icebob that does work indeed! I just didn't know we had to make data a function, did I miss this in the docs?
@cristijora your point of adding the submit separately sort of opened my eyes for this option, nice, but now I see it is possible in one go with the form component I stick with that ;-)
Great work!
Yes, maybe I need to correct the examples.
Most helpful comment
It's working with method too, just in this case data have to be function and
thiswon't be undefined.https://jsfiddle.net/0mg1v81e/203/