1.7.0 • Published 4 years ago

@jjsoft2018/donna-awesome-form v1.7.0

Weekly downloads
-
License
MIT
Repository
gitlab
Last release
4 years ago

vue-awesome-form

a vue form component just like json-editor

Install

# npm/yarn
npm install vue-awesome-form 
yarn add vue-awesome-form

Use

register the component

import Vue from 'vue'
import SchemaForm from 'vue-awesome-form'
import 'vue-awesome-form/dist/main.css'

Vue.component('schema-form', SchemaForm)

use in component

<schema-form
  ref="schemaForm"
  :schema="formData.schema"
  :value="formData.value"
></schema-form>

CDN

<script src="https://unpkg.com/vue-awesome-form@latest/dist/main.js"></script>
<script src="https://unpkg.com/vue-awesome-form@latest/dist/main.css"></script>

Props:

schema:an object like this

    "register": {
        "type": "TheTree",
        "title": "register",
        "properties": {
            "name": {
                "type": "TheInput",
                "title": "name",
                "rules": {
                    "required": true,
                    "message": "The name cannot be empty"
                }
            },
            "location": {
                "type": "TheTree",
                "title": "address",
                "propertyOrder": 3,
                "properties": {
                    "province": {
                        "type": "TheInput",
                        "title": "province",
                        "rules": {
                            "required": true,
                            "message": "The province cannot be empty"
                        }
                    },
                    "city": {
                        "type": "TheInput",
                        "title": "city",
                        "rules": {
                            "required": true,
                            "message": "The city cannot be empty"
                        }
                    }
                }
            }
        }
    }

value: the initValue of the form

"register": {
    "name": "wqe",
    "location": {
      "province": "beijing",
      "city": "beijing"
    }
}

methods:

validate: validate the form and return the result and the value of the form

resetFields: reset the form to init value

handleSubmit() {
  this.$refs.schemaForm.validate((err, values) => {
    if(err) {
      console.log('fail');
    } else {
      console.log('succ', values);
    }
  })
},
handleReset() {
  this.$refs.schemaForm.resetFields();
}

Demo

the following demo contains all the functions of the component and the supported form items.

demo: http://jsrun.net/bKgKp/embedded/all/light/

This article introduces the detailed implementation of this component.

1.7.0

4 years ago

1.6.17

4 years ago

1.6.16

4 years ago

1.6.15

4 years ago

1.6.14

4 years ago

1.6.13

4 years ago

1.6.12

4 years ago

1.6.11

4 years ago

1.6.10

4 years ago

1.6.9

4 years ago

1.6.8

4 years ago

1.6.7

4 years ago

1.6.6

4 years ago

1.6.5

4 years ago

1.6.3

4 years ago

1.6.2

4 years ago

1.6.1

4 years ago

1.6.0

4 years ago

1.5.50

4 years ago

1.5.49

4 years ago

1.5.48

4 years ago

1.5.47

4 years ago

1.5.46

4 years ago

1.5.45

4 years ago

1.5.44

4 years ago

1.5.43

4 years ago

1.5.42

4 years ago

1.5.41

4 years ago

1.5.40

4 years ago

1.5.39

4 years ago

1.5.38

4 years ago

1.5.37

4 years ago

1.5.36

4 years ago

1.5.35

4 years ago

1.5.34

4 years ago

1.5.33

4 years ago

1.5.32

4 years ago

1.5.31

4 years ago

1.5.30

4 years ago

1.5.29

4 years ago

1.5.28

4 years ago

1.5.27

4 years ago

1.5.26

5 years ago

1.5.25

5 years ago

1.5.24

5 years ago

1.5.22

5 years ago

1.5.21

5 years ago

1.5.20

5 years ago

1.5.19

5 years ago

1.5.18

5 years ago

1.5.17

5 years ago

1.5.16

5 years ago

1.5.15

5 years ago

1.5.14

5 years ago

1.5.13

5 years ago

1.5.12

5 years ago

1.5.11

5 years ago

1.5.10

5 years ago

1.5.9

5 years ago

1.5.8

5 years ago

1.5.7

5 years ago

1.5.6

5 years ago

1.5.5

5 years ago

1.5.4

5 years ago

1.5.3

5 years ago

1.5.2

5 years ago

1.5.1

5 years ago

1.5.0

5 years ago

1.4.0

5 years ago

1.3.9

5 years ago

1.3.8

5 years ago

1.3.7

5 years ago

1.3.6

5 years ago

1.3.5

5 years ago

1.3.3

5 years ago

1.3.2

5 years ago

1.3.0

5 years ago

1.2.9

5 years ago

1.2.8

5 years ago

1.2.4

5 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.3.1

5 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago