Vue Form component on hooks

vue-form

Vue Form component on hooks.

Installation

npm i @detools/vue-form

Usage

<script>
import { Button } from 'element-ui'
import Form, { Input } from '@detools/vue-form'

export default {
  data() {
    return {
      formValues: {},
    }
  },

  methods: {
    handleSubmit(values) {
      this.formValues = values
    },
  },

  render() {
    return (
      <div>
        <h1>Basic Form</h1>
        <div class="wrapper">
          <div class="form">
            <Form handleSubmit={this.handleSubmit}>
              <Input name="username" placeholder="Username" />
              <br />
              <br />
              <Button nativeType="reset">Reset</Button>
              <Button nativeType="submit" type="primary">
                Save
              </Button>
            </Form>
          </div>
          <div class="values">
            <strong>Form Values</strong>
            <br />
            <br />
            <div>{JSON.stringify(this.formValues, null, 2)}</div>
          </div>
        </div>
      </div>
    )
  },
}
</script>

Available Connected Components

  • Checkbox
  • DatePicker
  • Input
  • InputNumber
  • Radio
  • Select
  • Slider
  • Switch
  • TimePicker
  • Form

Roadmap

  • Add remaining components
  • Add validation examples

GitHub