I finally got it working. It appears it was cache issue. Before I posted here I emptied cache and did a hard reload, but it wasnt working. Now after some time it works. Btw. I'm using Cloudflare. Maybe this will help someone someday.
Vue - How to add a new field to form?
So I want to add new field to Update Contact Information form.
I open file /vendor/laravel/spark/resources/assets/js/settings/profile/update-contant-information.js and I make this changes:
data() {
return {
form: $.extend(true, new SparkForm({
name: '',
email: '',
isBusiness: 0 // new line
}), Spark.forms.updateContactInformation)
};
},
ready() {
this.form.name = this.user.name;
this.form.email = this.user.email;
this.form.isBusiness = this.user.isBusiness; // new line
},
And then I run Gulp. However these new lines are not visible in app.js after gulp is compiled.
Why? And how to make this work?
It's quite simple. Every file in vendor folder has its equivalent in \resources\assets\js\spark-components.
And everything you put into the \resources\assets\js overwrites the setup in vendor folder (or adds it if it does not exist in vendor folder)
So simple put your code into the resources file, that's it. That is also the way to overwrite spark methods in js code without physically overwritting them.
Please or to participate in this conversation.