Reusable VueJS Based Form Elements styled with Bootstrap 4
javascript
// Bring in the Javascript Distribution
import Vue from 'vue'
import VueFormElements from '@processmaker/vue-form-elements'Vue.use(VueFormElements)
`
Using the above, the components are globally registered with VueJS.Example Usage For Single Form Element (Using Single File Components)
`javascript
import {FormInput, FormSelect} from '@processmaker/vue-form-elements'new Vue({
el: '#example',
components: {
FormInput
}
})
`Components
$3
Renders an input field, allowing types of text, password, email, search, date, datetime-local$3
Renders a checkbox field, allowing the grouping of checkboxes by passing in a name property.$3
Renders a radio button group, passing in options through a property.$3
Renders a select field with options being passed in through a property.$3
Renders a textarea fieldField Parameters
The following are parameters used in the components to configure it$3
Provides two-way binding to a variable.$3
Specify the name of the field. This is used for certain operations and for labeling when used with validation rules.$3
Specifies the type for the input field. This can be text(default) or password or any other html5 supported type.$3
An array of objects that represents possible options for the field. Each object contains two properties. 'content' is
the text label of the option. 'value' is the value that will be assigned if the option is selected.$3
An optional error to render with the field.$3
The number of rows to provide input for the textarea control.Other properties may exist. Refer to the source code of the control to see what additional properties are available.
Validation
Validation is performed by the https://github.com/skaterdav85/validatorjs library in order to resemble
the functionality of Laravel validation rules. Please see this repository for more information on applicable
rules.$3
* validation: string representation of the validation rules
* validationData: a reference to a data model to validate against. Useful if you are using rules that reference other properties
* validationMessages: A custom map of validation messages to use if defaults are not wanted (ex: translations). See validatorjs repository for the formatting of this parameter.
Running with Docker (Development)
To test VueFormElements using Docker, you can build this image locally and test it out. By running these commands from your terminal.
`shell
docker build vfe: .
docker run -p 8080:8080 -d vfe:
`
ORYou can use docker compose to spin up your container easily by running these commands
`shell
docker compose build
docker compose up
`
Once you are done, you can control + c` to terminate the process