diff --git a/firebase.md b/firebase.md index bb45945..ed48195 100644 --- a/firebase.md +++ b/firebase.md @@ -605,3 +605,144 @@ An example of passing a prepend icon to a ``: Expects the v-img component. Scoped props should be applied with v-bind="props". + +## Forms + +Forms should be done dynamically - creating a `v-for` on a text field input. You should create all the props values in an object in `data`. + +The `` should specify a `v-model` prop, which should reference a boolean on whether the form is valid or not. You should set a `ref` prop, which is the name you will refer to the form. + +```html + +``` + +You would refer to this form with `this.$refs.form`. + +```html + + + + +``` + +Here we have created the text fields we want to render and we are looping over `formFields` to fill in the props and slots. + +```javascript +{ +valid: false, +load: false, +formFields: [ + { + name: "Email", + rules: [ + v => !!v || "You must enter an email address.", + v => /.+@.+/.test(v) || "Email is not valid." + ], + placeholder: "Email", + successmessage: "Email is valid.", + prependIcon: "mdi-at", + value: "" + }, + { + name: "Password", + rules: [ + v => !!v || "You must enter a password.", + v => (v && v.length >= 8) || "Minimum 8 characters." + ], + placeholder: "Password", + successmessage: "Password is valid.", + prependIcon: "mdi-lock", + appendIconShow: "mdi-eye", + appendIconHide: "mdi-eye-off", + showIconData: false, + value: "", + password: true + } +] +} +``` + +This is the data object in the ` @@ -151,20 +198,4 @@ export default { color: white !important; opacity: 1; } - -.v-input__slot:hover { - border-color: #6fbd44; -} - -.theme--light.v-text-field--outline:not(.v-input--is-focused):not(.v-input--has-state) - > .v-input__control - > .v-input__slot:hover { - border-width: 1px !important; - border-style: solid !important; - border-color: #6fbd44 !important; -} - -.align-right { - text-align: right; -}