I am currently passing a set of props, "propSet", to a child component. The props are computed and detect an 'edit mode' boolean and change accordingly.
"propSet" defines the following form input props: color, filled, dense, outlined, readonly, required, and rules.
All the props work, except for "rules". I receive the following error message in the console every time a child component uses the 'editMode == true' configuration of "propSet":
[Vue warn]: Invalid prop: type check failed for prop "rules". Expected Array, got Object
I have tried quite a few things, but in particular, I've tried to:
Add type validation to the Child Component for the rules array
props: ['propSet'] //originalprops: { propSet: Array } //updated
Utilized Object.entries() to change the object to an array
var rulesSet = Object.entries(this.rules)
Change rules - tried to configure the rules several different ways
-
//original rules: { required: (v) => !!v || "This field is required", autoComplete: (v) => !!(v && v.length) || "This field is required", }, -
//updated rules: [{ required: (v) => !!v || "This field is required"},{ autoComplete: (v) => !!(v && v.length) || "This field is required", }],
-
I've read the documentation for Props several times, and I haven't seen an answer to my issue there (unless I'm overlooking it). I've also read the documentation I could find related to the rules array in the Vuetify API.
I've also read quite a few SO questions related to Vue.js, props, and components.
I think I might just be missing something very obvious.
Here is a codepen with a different set of props for brevity's sake, which demonstrates the problem: