Open PrafullaKumarSahu opened 5 years ago
You can try create the follow method in your Custom Vue Component:
findFieldByAttribute (attribute) {
return this.$parent.$children.find(brotherField =>
brotherField.field.attribute === attribute,
);
}
Usage:
const field1 = this.findFieldByAttribute('field_1');
const field1Value = field1.value;
laravel 5.8 Nova 2.0.0
I have two field based on first field I want to set the value of second and it is upto the user to use the set value or may insert a new one and submit the form.
I am adding custom field like
Now in
CustomField
classdependsOn()
method I can access, the dependsOn field name, that isfield_1
, also in Vue > FormField.vue I can access it as{{ field.dependsOnField }}
in template and asconsole.log(this.field.dependsOnField);
in JS part, but how I can get the value offield_1
and also on change I can get new value, I am new to Vue JS, but I tried it like